What's new

Global Parameters

ftkalcevic

Member
I can see the method on IADRoot, CreateEmptyGlobalParameters, which creates an IADGlobalParameterSession, but I can't see how I can tell a part or assembly to use these global parameters.

Any ideas?

Thanks,
Frank
 
Frank,

One thing is to think of them as "Project Variables" rather than "Global Variables." You define the "Project Variables" separately and then load (and save) them into each Part or Assembly making up the Project. Each such "loaded and saved) file has access to the "Project Variables." To change their values you have to edit the "Project Variables" file using the "Global Parameters editor.
 

ajayre

Alibre Super User
Hi Frank,

It seems from your postings you are working on an application that uses the API. What is your end-goal? Perhaps WizoScript could fit the bill? If it is lacking some functionality you need in some way then it would be helpful to me to know what it is so I can look at adding it.

Andy
 

markporter

Member
Andy,
Should WizoScript work with configurations of Global Parameters? I have written a script that can list the names and types of parameters, but I get stuck when trying to list the configurations and access their parameter values.

GlobalParameters("MyGPFile", False)
# print number of configurations
print len(obj.Configurations)
# print name of each configuration, and whether active
for i, configuration in enumerate(obj.Configurations):
print("{}% {} {}".format(obj.Configurations.Name,obj.Configurations.IsActive))
# print name of active configuration
conf = obj.GetActiveConfiguration()
print conf.Name

The console states "Object reference not set to an instance of an object." when trying to access the Property "obj.Configurations".
 

ajayre

Alibre Super User
Hi Mark,

Where is 'obj' set? Did you mean to do this?

Code:
obj = GlobalParameters("MyGPFile", False)

Andy
 

markporter

Member
Hi Andy,

Yes, I must have dropped that in the cut&paste.

Here's the code.

Code:
obj=GlobalParameters("MyGPFile", False)
# print number of parameters
print len(obj.Parameters)
# print number of configurations
# print name and type of each Parameter
for i, parameter in enumerate(obj.Parameters):
    print("{}% \t\t {}".format(obj.Parameters[i].Name,obj.Parameters[i].Type))
print len(obj.Configurations)
# print name of each Configuration, and whether active
for i, configuration in enumerate(obj.Configurations):
   print("{}% {} {}".format(obj.Configurations[i].Name,obj.Configurations[i].IsActive))
# print name of active configuration
conf = obj.GetActiveConfiguration
print conf.Name

The section dealing with parameters works fine, then it fails when accessing Configurations.

Mark
 

ajayre

Alibre Super User
As far as I can tell this is a bug in AD. Seems any attempt to access the configurations results in this error. Strange as I am sure it used to work. I've reported it to them.

Andy
 

markporter

Member
Perhaps the Excel Integration relies on the same code. It can't read or create configurations of Global Parameters, and gives the same error.upload_2017-10-6_7-39-44.png
 

markporter

Member
This has been fixed in 2018
Code:
gpf=GlobalParameters("MyGPFile", False)

# print number of parameters
print "Number of Parameters =",
print len(gpf.Parameters)

# print number of configurations
print "Number of Configurations =",
print len(gpf.Configurations)

# print name of active configuration
print "Name of active configuration =",
print(gpf.GetActiveConfiguration().Name)
print

# print name and type of each Parameter
print "Name and type of each Parameter"
for i, parameter in enumerate(gpf.Parameters):
    print("{} \t\t {}".format(gpf.Parameters[i].Name,gpf.Parameters[i].Type))
print

# print name of each Configuration, and whether active
print "Name of each Configuration, and whether active"
for j, configuration in enumerate(gpf.Configurations):
   print("{} \t\t {}".format(gpf.Configurations[j].Name,gpf.Configurations[j].IsActive))
 

GIOV

Alibre Super User
So What is wrong? Wizoscript V3.51..gives this message:
GEOMAGIC VERSION 19.0.01930 is not supported, Please update Wizoscript.
upload_2018-4-30_22-55-22.png
 
Top