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

vba di solidworks

  • Thread starter Thread starter titurbina
  • Start date Start date

titurbina

Guest
as I have to remove the annoying request of confirmation of the quota in vba of solidworks.
I'll explain better.
in the macro below indicated I insert through vba of solidworks a rectangle , but when I have to confirm the quota the program stops and asks me confirmation, as from attached in pdf, how do I not ask every time to confirm?


vsklines = part.sketchmanager.createcornerrectangle(xpianocoord, ypianocoord, zpianocoord, xretangle, yrettangle, zretangle)
set part = swapp.activedoc
set selmgr = part.selectionmanager
boolstatus = part.extension.selectbyid2("frontal plane", "plane", 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
Thank you.
:finger::finger::smile::smile:
 

Attachments

Hi.
to solve your problem do this way:
- before entering the quota or beginning of your module (must be below the swapp variable setting) enter this line

swapp.setuserpreferencetoggle swinputdimvaloncreated, false

this eliminates the request for confirmation and it is as if I went to remove the flag "in instruments -> options -> naral -> "see the value of the quota in creation".

I recommend you at the end of your macro

swapp.setuserpreferencetoggle swinputdimvaloncreate, true

as the flag would remain deactivated, not asking for confirmation in the design phase.

with "swapp.setuserpreferencetoggle" followed by a variable (see manual bees) you can customize all options settings by macro.

Let me know if it works and if you need anything else, let me know, I'll help you.

good programming
 
I put myself here because it could be useful as a discussion to collect problems on the various vbas we find or do.
I found the segunte that would be useful, but unfortunately I can't make it work.
 

Attachments

Sorry for the delay:rolleyes:
I love the macro and now it's working.
the reasons why it didn't work were mainly two:
- the swapp variable was not declared
- the open part file must have a file name length longer than 15 characters otherwise by error.
In case you need it you can develop it so as to manage errors and manage custom properties from interface or external text files.
I modified it on 2009, and automatically you should update references for 2010.:smile:
Let me know if it works.

I am available to those who need help in the limit of my knowledge. :wink:

Hi.
 
Sorry for the delay:rolleyes:
I love the macro and now it's working.
the reasons why it didn't work were mainly two:
- the swapp variable was not declared
- the open part file must have a file name length longer than 15 characters otherwise by error.
In case you need it you can develop it so as to manage errors and manage custom properties from interface or external text files.
I modified it on 2009, and automatically you should update references for 2010.:smile:
Let me know if it works.

I am available to those who need help in the limit of my knowledge. :wink:

Hi.
Nice thanks. I admit I know very little about vba and only now I start putting my nose in it. I realize the importance of being able to do at least the little more than trivial things in order to discuss with you about this macro, which I found interesting for those like me, has to manage the files with the directory system and give with the name of the reference file both for the main custom properties (university between files and properties) as well as allow me to spot the thing sought in the file list. example of name of pipe in piping plant: identifying tube(axis in this case)-committee-design code = spt001-300_c481pm1_pi-37380.
I'm asking if you can attach the file with the correct code that I'm trying to crack, too.
 
I saw you changed the name of the property.
how macro is it now how you care or would you like to expand it? I didn't understand.
bye:
 
Well! in fact if there was the way to customize it a little easier than going to count how many letters there are in the file name, where to go to cut, etc. type with a preview of the results by inserting data masks and similar...:biggrin: :4410:
 
Here I am, better late than ever.:biggrin:
I attach a reepilogative mask of three methods for the properties of the component, where you can enjoy and adapt it to your needs.
If you have any other need let me know.
I have long created an addin on the taskpane (see attached image), customized according to my standard.
hello and excuse me for the delay, but the job presses me....:eek:
 

Attachments

Here I am, better late than ever.:biggrin:
I attach a reepilogative mask of three methods for the properties of the component, where you can enjoy and adapt it to your needs.
If you have any other need let me know.
I have long created an addin on the taskpane (see attached image), customized according to my standard.
hello and excuse me for the delay, but the job presses me....:eek:
You're a fool. :4425: If I could give you a little help in work for gratitude. I am moved away from your knowledge of vba but ..plan plan I approach.:36_1_12:
 

Forum statistics

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

Members online

No members online now.
Back
Top