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

the macros of solidworks

jenuary

Guest
the macros of solidworks...:mixed:
It's been a long time since I wanted to open this discussion, because more and more often, within the forum, users need macros that can
solve the problem.
we have seen many times that problems are quite subjective, dictated by a working system at times improper or unflexible, where in reality
a macro is not the best solution.
apart from these situations, many common needs exist from my point of view, where a macro could solve the situation, with huge savings of
time limiting also error.
I would like to share with all of you, which macros would be more useful than others, sharing them perhaps by type, such as

- You know what?
- Parties
- Come on.
-customized ownership

once you create a list of priorities, it would be nice to create them together, according to your own knowledge, giving benefit to all.
Perhaps the moderators will know, if they feel useful this discussion, about how they can do it.

I am convinced that some requests will be able to be answered without great effort, others will have to work a bit, others will have to have
an alternative solution within the controls of solidworks.
of course to those who are interested, this will allow them to grow in this aspect, succeeding in planning a little what they need.

Good day to all:finger:
 
that you know, there is a macro creation manual in solidworks? I have a visual basic guide applied to excel and is very similar to command level;
Is there anything like that on the market?
Thank you.
 
the macros of solidworks...:mixed:
It's been a long time since I wanted to open this discussion, because more and more often, within the forum, users need macros that can
solve the problem.
we have seen many times that problems are quite subjective, dictated by a working system at times improper or unflexible, where in reality
a macro is not the best solution.
apart from these situations, many common needs exist from my point of view, where a macro could solve the situation, with huge savings of
time limiting also error.
I would like to share with all of you, which macros would be more useful than others, sharing them perhaps by type, such as

- You know what?
- Parties
- Come on.
-customized ownership

once you create a list of priorities, it would be nice to create them together, according to your own knowledge, giving benefit to all.
Perhaps the moderators will know, if they feel useful this discussion, about how they can do it.

I am convinced that some requests will be able to be answered without great effort, others will have to work a bit, others will have to have
an alternative solution within the controls of solidworks.
of course to those who are interested, this will allow them to grow in this aspect, succeeding in planning a little what they need.

Good day to all:finger:
discussion that I find very interesting, personally I have some models that I have to do often in always different measures, I have created excell sheets with embedded macro and after setting the various measures in the folio launch the macro that updates my open axieme.
I still take the opportunity to ask you, since you are expert in macros, as you do for example if of a part that has a configuration has to create a new one and set a quota with a value other than configuration 1.

I explain better, I can create the configuration and have the exact quota if I leave with a part that already has two configurations, and the quota is set "for this configuration" instead if I leave on one side with only one configuration, when I create the second and I go to change the quota this overwrites also the first configuration.

This didn't happen with 2008 and maybe even with 2009.

you know how you do it from macro to set a quota "for this configuration"
 
that you know, there is a macro creation manual in solidworks? I have a visual basic guide applied to excel and is very similar to command level;
Is there anything like that on the market?
Thank you.
in this website http://www.cadsharp.com/videos/ find material for payment and other free.

on the net you find a lot if you want to lose some time do a search on macro solidwoks and get rid of yourself.

for the book see if you care http://books.google.it/books?id=sg6...tomating solidworks 2013 using macros&f=false
 
discussion that I find very interesting, personally I have some models that I have to do often in always different measures, I have created excell sheets with embedded macro and after setting the various measures in the folio launch the macro that updates my open axieme.
I still take the opportunity to ask you, since you are expert in macros, as you do for example if of a part that has a configuration has to create a new one and set a quota with a value other than configuration 1.

I explain better, I can create the configuration and have the exact quota if I leave with a part that already has two configurations, and the quota is set "for this configuration" instead if I leave on one side with only one configuration, when I create the second and I go to change the quota this overwrites also the first configuration.

This didn't happen with 2008 and maybe even with 2009.

you know how you do it from macro to set a quota "for this configuration"
for the configuration of a quota, the process is very simple, let's talk for example a part that has two configurations and I have a quota that must have different value between the two configurations:
- double click on the share to change its value, and next to the value you will find the configuration button to apply the change.

The attached image makes you better understand how to do it.

As for the change of the share in that specific configuration, the process is very simple, but the code remains "static" and not dynamic, I explain better:
- to change the value to a quote via bees, you must know the ideal of the quota to change (e.g.d2@schizzo1@13087007.sldprt)
- select it
- and change the value, specifying the configuration that interests you, or all
- the macro code is as follows:

option explicit

dim swapp as sldworks.sldworks

dim swmodel as sldworks.modeldoc2

dim swmodeldocext as sldworks.modeldocextension

dim swselmgr as sldworks.selectionmgr

dim swdim as sldworks.dimension

dim dimvalue as variant

dim boolstatus as boolean

dim longstatus as long



sub main()



set swapp = application.sldworks

set swmodel = swapp.activedoc

set swselmgr = swmodel.selectionmanager

set swmodeldocext = swmodel.extension



boolstatus = swmodeldocext.selectbyid2("d2@schizzo1@13087007.sldprt", "dimension", 0, 0, false, 0, nothing, swselectoptiondefault)

set swdim = swmodel.parameter("d2@schizzo1")

dimvalue = swdim.getsystemvalue3(swthisconfiguration, empty)

dimvalue(0) = dimvalue(0) / 2

longstatus = swdim.setsystemvalue3(dimvalue(0), swsetvalue_inthisconfiguration, empty)

swmodel.editrebuild3

end


Hi.
 

Attachments

  • Configurazione quota.webp
    Configurazione quota.webp
    6.4 KB · Views: 148
that you know, there is a macro creation manual in solidworks? I have a visual basic guide applied to excel and is very similar to command level;
Is there anything like that on the market?
Thank you.
as ciarly said, on the net you find a lot, but then it should be changed to pleasure.
on the market there are very few books and these are right earth, they teach you some objects of the bees, but it is easier to find something on the net.
the difficulty but ancjhe the right way is to follow the scale of the bees objects you find in the online bee guide, where you understand for what objects you have to pass to get what you need.
for example you have to get the name of the sketch that generated extrusion1, you must first pass through the object of the feature extrusion1 and get the subfeatures (the sketch is a subfeature contained in the feature).

If I can find you something, I'd love to

Hi.
 
Sorry the time but I wanted to prepare you an example of what I meant, let's say my macros are done a bit like that.
for the configuration of a quota, the process is very simple, let's talk for example a part that has two configurations and I have a quota that must have different value between the two configurations:
- double click on the share to change its value, and next to the value you will find the configuration button to apply the change.

The attached image makes you better understand how to do it.
until there are.

As for the change of the share in that specific configuration, the process is very simple, but the code remains "static" and not dynamic, I explain better:
- to change the value to a quote via bees, you must know the ideal of the quota to change (e.g.d2@schizzo1@13087007.sldprt)
- select it
- and change the value, specifying the configuration that interests you, or all
- the macro code is as follows:
I like to know that it is very simple but not for everyone.

in the attached file there is a part of sw and a file of excell.
opens the cube in solid works and the excell file at this point launches the macro from excell.
I use this system because in a sheet of excell I can make all the calculations I want and take the values to set on my quotas.


as you will see my problem is succeeding in this macro to set the value of the quota "for this configuration"

I saw your code but I couldn't put it in the macro.
 

Attachments

hi, I tested the macro and modified so that it worked, take a look and if something is not clear we see to deepen.
good weekend:finger:
 

Attachments

hi, I tested the macro and modified so that it worked, take a look and if something is not clear we see to deepen.
good weekend:finger:
First of all, thank you very much.

I take advantage of it.

1 from the macro I took off some lines and added some size, it works, I wanted to know if you think it's correct.
2 by chance can you make portions of code recallable in other macros?

Let me explain, the part of code that configures a part can be recalled in the configuration macros of different assemblies?
 

Attachments

the code is ok, I recommend you always insert a description in the code group, e.g. "here I recover the quota and I pass the new value", this because even if in a year you take it back in hand, you are immediate in the changes, without taking everything in hand.
for the question of point 2, it is necessary to see case by case, because the selectbyid selection requires that you pass the full path of your selection, in your case a quota, but it is located inside a part that in turn is inside a set.

test and see the result immediately.

Hi.
 
the code is ok, I recommend you always insert a description in the code group, e.g. "here I recover the quota and I pass the new value", this because even if in a year you take it back in hand, you are immediate in the changes, without taking everything in hand.
for the question of point 2, it is necessary to see case by case, because the selectbyid selection requires that you pass the full path of your selection, in your case a quota, but it is located inside a part that in turn is inside a set.

test and see the result immediately.

Hi.
I exhume this old discussion, to ask jenuary, since the macros chew very well.

in solidwoks, is there a call that returns, the value of flat repetition in a sheet file?

thanks early
 
Hi, Ciarly.
for flat repetition value do you mean the minimum size of the sheet body encumbrance box?
 
I attach the required macro with a sheet metal part on which I did the tests.
it is not necessary that the flat repetition is active to obtain the floor box.
infinite graces of the macro.

I wanted to ask for the values put out if they are decimal, write a dozen digits after the comma can be cut somehow?
 
Sure, let's get three, shall we? so on Monday morning I'll show you.
According to my opinion since it is a sheet and these are almost always bent, tolerance is wide and a figure is sufficent.

rather if the sheet has more configurations, what happens? Is one trial?

at this point as you see when you give a hand you are immediately taken your arm, I would not like to take too much of your time, thank you
 
Hi, Ciarly.
for me it is indifferent, if you want to post a duplicate that goes to write in the configuration property.
Do you have any preference for the name of the property since you are the open track for this macro?
 
Hi, Ciarly.
for me it is indifferent, if you want to post a duplicate that goes to write in the configuration property.
Do you have any preference for the name of the property since you are the open track for this macro?
no the name is fine, even because it is enough to change it in the macro.

rather if at the end, it suspends the flat repetition again, it would leave the sheet folded as it was in departure.

for the duplicate, can this pull out the values of the different cofigurations? That would be great.
 
instead I am looking for a macro for solidworks 2016 that, automatically, when save a side file (or together) generates a drawing board containing the perspective view and saving with the name of the generating file. you tto quewsto would serve me to hold tied with the standard pdm of solidworks the pieces to the boards datta first creation of the mathematicians. You know if there's one that does anything I'm looking for?
 

Forum statistics

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

Members online

No members online now.
Back
Top