• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

macro x pdf

  • Thread starter Thread starter BOSCO '71
  • Start date Start date
I would do so, implement it at the next release.
Code:
'Decomment to Need: objapp.startcommand (32876) 'refresh f5

fullfilepath3dimg = path + "\" + name + "." + "jpg"

seimagequality = 3' seimagequalitylow 1 ; seimagequalitymedium 2 ; seimagequalityhigh 3
objapp.activewindow.view.saveasimage(fullfilepath3dimg, 318, , , , , seimagequality ) '318 is the width I need, the height comes accordingly
attention to the full name of the file you want to call "fullfilepath3dimg" as well as you wrote there are several errors
 
thanks for this macro!
can you prevent it from being asked if you want to overwrite the pdf (if already exists), by automatically overwrite it?
Coptics
 
overwriting without notice is not a recommended action. is not provided in the parameters of the "saveas" solidedge method, so if you want to proceed in that sense the solution would verify the presence of the file before the rescue and then elitize it.
 
In fact I use this macro to save at the same time in dwg, pdf and stp.
the open dft file is not overwritten, and the saving of the 3 files is of interest to me in the current state of the dft, so I like to overwrite them.
the code to add to the macro (what controls if the file exists and possibly deletes it) could I have it?
Thank you.
 
to pass the code I have no problem, but the complete one is heavily customized compared to that of wasp to take into account the storage needs of my company (file names, paths, revision indices. ...).

I put you below the few lines that make verification and cancellation for dxf and pdf. If you interpret the variables well, you should be able to use them, or tell me that I put the full code on you, but I think it gets more complicated.
Code:
[Bleep]
filepdf = (path + "\" + name + "." + "pdf") ' builds the full name of the pdf file
if fso.fileexists (filepdf) then ' check if it already exists and if so delete it
del = fso.deletefile(filepdf) ' delete
end if
call objdoc.saveas(filepdf) ' saves the new pdf in the established path


[Bleep]
filedxf = (path + "\" + name + "." + "dxf") ' builds the full name of the dxf file
if fso.fileexists (filedxf) then ' check if it already exists and if so delete it
del = fso.deletefile(filedxf) ' delete
end if
call objdoc.saveas (filedxf) ' saves the new dxf in the established path
 
to pass the code I have no problem, but the complete one is heavily customized compared to that of wasp to take into account the storage needs of my company (file names, paths, revision indices. ...).

I put you below the few lines that make verification and cancellation for dxf and pdf. If you interpret the variables well, you should be able to use them, or tell me that I put the full code on you, but I think it gets more complicated.
Code:
[Bleep]
filepdf = (path + "\" + name + "." + "pdf") ' builds the full name of the pdf file
if fso.fileexists (filepdf) then ' check if it already exists and if so delete it
del = fso.deletefile(filepdf) ' delete
end if
call objdoc.saveas(filepdf) ' saves the new pdf in the established path


[Bleep]
filedxf = (path + "\" + name + "." + "dxf") ' builds the full name of the dxf file
if fso.fileexists (filedxf) then ' check if it already exists and if so delete it
del = fso.deletefile(filedxf) ' delete
end if
call objdoc.saveas (filedxf) ' saves the new dxf in the established path
thanks apegana,
I entered the code, but sends me the message "necessary object" to the line "if fso.fileexists (filepdf) then".
I try to see other posts where a similar error occurred.
 
in the initial part of the macro, where you define variables, you have to put:

set fso = createobject("scripting.filesystemobject")

Sorry I didn't write it because it seemed to remind me that there was also in the original wasp, but obviously I added it.
Hi.
 
save and export v1.2

in the code are examples of usage as required in the above posts.
version :
v.1.2 inserted function deletefileifexists ('elimina file if it exists') with relative examples before each "save",
to avoid the question: 'the file already exists, overwrite? '
attention: incorrect use and/or incorrect programming result in deletion and overwriting of files without user confirmation request.
for this reason the function is normally not active but commented, use it at your own risk
v.1.1 save as image e save developed for sheetmetal
save all first level 3d files related to the draft​
 

Attachments

in the initial part of the macro, where you define variables, you have to put:

set fso = createobject("scripting.filesystemobject")

Sorry I didn't write it because it seemed to remind me that there was also in the original wasp, but obviously I added it.
Hi.
Thank you again. It works perfectly.
 
save and export v1.2

in the code are examples of usage as required in the above posts.
version :
v.1.2 inserted function deletefileifexists ('elimina file if it exists') with relative examples before each "save",
to avoid the question: 'the file already exists, overwrite? '
attention: incorrect use and/or incorrect programming result in deletion and overwriting of files without user confirmation request.
for this reason the function is normally not active but commented, use it at your own risk
v.1.1 save as image e save developed for sheetmetal
save all first level 3d files related to the draft​
Thank you vespa,
I also tried the macro "Save and Export", but version 1.2 gives error to line 263, while version 1.0 works very well.
You are absolutely indispensable. ..without your support I would not have known how to solve.
 
Thank you vespa,
I also tried the macro "Save and Export", but version 1.2 gives error to line 263, while version 1.0 works very well.
You are absolutely indispensable. ..without your support I would not have known how to solve.
Bye. on line 263 I have a "end sub" that cannot give error: verify that you have not added or removed rows or do a ctrl-c to copy the full error message to give me some extra information.
those lines concern the saving development. If you have activated "export3d = true", explain to me what situation you are (dft or psm, open or closed files).
the macro works if there is only one instance of open solidedge (in windows taskmanager you find only one edge.exe), and works on the active (/window file) document.
 
Bye. on line 263 I have a "end sub" that cannot give error: verify that you have not added or removed rows or do a ctrl-c to copy the full error message to give me some extra information.
those lines concern the saving development. If you have activated "export3d = true", explain to me what situation you are (dft or psm, open or closed files).
the macro works if there is only one instance of open solidedge (in windows taskmanager you find only one edge.exe), and works on the active (/window file) document.
Good morning wasp,
This gives me the macro when I am in a dft ("export3d = false")
 
'version:
' v.1.3 bug fix. now in general options you can enable additional functions
' v.1.2 inserted deletefileifexists function ('elimina file if exists') with relative examples before each "save",
' to avoid the question: 'the file already exists, overwrite? '
'Beware: incorrect use and/or incorrect programming result in deletion and overwriting of files required to confirm by the user.
'for this reason the function is normally not active but commented, use it at your own risk
' v.1.1 saves as image and saves developed for sheetmetal

I changed the code structure a bit to simplify the ability of the main functions by setting true/false (= true/false), grouped under the general options section.

export folder (variable route) is normally considered equal to the source file folder.
who wants to customize it will have to change the code manually.
 

Attachments

Good morning, everyone.
in some dfts I have a sheet with a specific name, we put "prove sheet".
I would like to be able to edit the PDF file so that: if in the dft there is no sheetprove the macro functions normally, if instead spreadsheet there, give me in output 2 pdf files, one with the only sheet try, the other with all the other sheets in the same order in which they are located.

I can't do it myself if anyone wants to help me... :redface:
the main problems I have are as follows:
  • identify how many sheets have a dft and which names have
  • interact with save options as pdf and in particular how to set sheets to convert
Any generous?
Thank you.
Matteo
 
the sheets are in activedocument.sheets or similar, then iterati (passed one by one) all the foges to read the name (.name)
.
the problem becomes the second point: interacting with the pdf save that does not para me have many options... .

so maybe it is easier to save the draft with a temporary name, you take off the sheet and continue. It's a much easier road. Good luck.
 
Good morning, I have the same need to understand how to do a certain operation. the macro save+pdf.wsf manages the rescue of pdf and dwg directly by pressing the macro key. I would like to be able to understand how to save (possibly automatically when I push "save") of the sample developed then of the dxf. thank you very much for courtesy!
 
the sheets are in activedocument.sheets or similar, then iterati (passed one by one) all the foges to read the name (.name)
.
the problem becomes the second point: interacting with the pdf save that does not para me have many options... .

so maybe it is easier to save the draft with a temporary name, you take off the sheet and continue. It's a much easier road. Good luck.
Thanks wasp, now I started a big job and I have little time to think about macros.... I will face the thing in a few weeks even if in eyes and cross it exceeds my skills.
 
Good morning, I have the same need to understand how to do a certain operation. the macro save+pdf.wsf manages the rescue of pdf and dwg directly by pressing the macro key. I would like to be able to understand how to save (possibly automatically when I push "save") of the sample developed then of the dxf. thank you very much for courtesy!
the standatard save does that. There are methods of programming beforesave and aftersave, but an add-in should be created, it is very complicated.

if you use the macro, you put its icon and click on it (the topic already dealt in other posts).
the latest version if launched in sheetmetal psm environment has the dxf function you ask.
'version:
' v.1.3 bug fix. now in general options you can enable additional functions
' v.1.2 inserted deletefileifexists function ('elimina file if exists') with relative examples before each "save",
' to avoid the question: 'the file already exists, overwrite? '
'Beware: incorrect use and/or incorrect programming result in deletion and overwriting of files required to confirm by the user.
'for this reason function is normally not active but commented, use it at your own risk
' v.1.1 saves as image and developed save for sheetmetalI changed the code structure a bit to simplify the ability of the main functions by setting true/false (= true/false), grouped under the general options section.
export folder (variable route) is normally considered equal to the source file folder.
who wants to customize it will have to change the code manually.
 
for my needs I created a small program of request approval drawings.

you select the documents you want to export (the name is created by concatenating code - revision - version) and created a new email with the zipped files attached and a default text in the object and body.

View attachment 46816
Hello, is this app downloadable somewhere? I would be very helpful, thank you.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top