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

macro import and rescue

  • Thread starter Thread starter infamia
  • Start date Start date

infamia

Guest
Good evening,

Is there any soul that helps me in this macro?
which may also be useful to other users.

I tell you the problem:

daily I get many compressed files that I have to fuck, import on sw and then save.

I can automate these phases with a macro that launch from sw.

es: Launching the macro, opening user form(which I did) I choose the compressed file and running these steps(disappearance(7 zip or winrar) ,import and save) ?

at the limit I am satisfied to disappear the hand file and choose the path where the .xt or .stp file is located...etc
inside the folder is always there and only 1 files with those formats

so far I have recorded the macro but I can't figure out how to collage the box where I insert the path and make the file fish.
private sub cmd_start_click()

set swapp = application.sldworks
boolstatus = swapp.loadfile2("txt_percorso1.value", "")set part = swapp.activedoc

' take snapshot
dim swsnapshot as snapshot
set swsnapshot = part.modelviewmanager.addsnapshot("home")
dim mymodelview as object
set mymodelview = part.activeview
mymodelview.framestate = swwindowstate_e.swwindowmaximized

' save as
longstatus = part.saveas3("txt_percorso1", 0, 0)

' close document
set swassembly = nothing
set part = nothing
swapp.closedoc "ce11_stampo mat. finestrini + parabrezza st1747-3d part drawing-20230127.sldasm"

end sub
Thank you very much
 

Attachments

  • Macro.webp
    Macro.webp
    26.4 KB · Views: 7
if you want to upload the file to the textbox that is populated you must, in the code contained in cmd_start,
make a verification.
Suppose the textboxes are called textbox1,textbox2, textbox3, textbox4,
the code below serves to create a variable that contains the file path to upload,
verifying which textbox is populated, you said that only one at a time is populated.

dim path as string 'file path to load
if textbox1.text<>" then
path=textbox1.text
end if
if textbox2.text<>" then
path=textbox2.text
end if
if textbox3.text<>" then
path=textbox3.text
end if
if textbox4.text<>" then
path=textbox4.text
end if
 
I would have liked to know if the code was useful to you.... .
then do not be surprised if by choice no complete macros are developed, because often there is not even a thank you, as in this case
 
I have long, in these cases, started putting dislikes, the pissed face to understand; in many cases it doesn't help anything, but sometimes someone prudes their nose and gets alive.
 
Sorry, but last week I was out and the notification email was on spam.

in the week I return to work, unfortunately carrying out these things during the lunch break it takes me a little. but it is a project that I must end.
Excuse me again
 

Forum statistics

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

Members online

No members online now.
Back
Top