Modify a Solidworks Global Variable Value - C# -


i trying modify global variables within c# code.

based on these 2 examples:

re: macro change global variable

2015 solidworks api - add , modify equations example (c#)

i have come following code, doesn't change global variables. also, when go equation manager after code runs has red xs equations , says "the syntax of equation incorrect".

string depth = "\"depth\" = " + param["part"].substring(0, param["part"].indexof("x")); string flangewidth = "\"flangewidth\" = " + param["width"];  swequationmgr = swmodel.getequationmgr(); swequationmgr.setequationandconfigurationoption(0, depth, (int)swinconfigurationopts_e.swallconfiguration, null); swequationmgr.setequationandconfigurationoption(0, flangewidth, (int)swinconfigurationopts_e.swallconfiguration, null); 

note: depth variable correctly evaluates ("depth" = 8) & flangewidth evaluates ("flangewidth" = 3.5).

can me doing wrong?

you can use modify variable based on name! unique other code samples show how set variable index!

sub setvar(name string, value variant)     set swapp = application.sldworks     set swmodel = swapp.activedoc     set sweqnmgr = swmodel.getequationmgr      = 0 sweqnmgr.getcount - 1         vsplit = split(sweqnmgr.equation(i), " = ")         vsplit(0) = replace(vsplit(0), chr(34), empty)         if vsplit(0) = name _             sweqnmgr.equation(i) = replace(sweqnmgr.equation(i), vsplit(1), value)     next end sub 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -