What's new

Is it possible to use a Global Parameters file from a script

R-man

Senior Member
Even though I've been using Alibre for a while, I've never made use of the Global Parameters and Equation Editor, so my understanding of how it works might be off base.

That said, as I understand it, when creating a part, I can add a circle to a sketch (for example) and select a value for its diameter from the equation editor. Then later the value can be changed in the Global Parameters file and the change will be reflected in the part.

My question is: Can I do the same in a script? So far it seems all I can do in a script is set the diameter to the value of a global parameter, but there is no link created, and changes in the Global Parameters file will not be reflected in the part. (?)
 

albie0803

Alibre Super User
When using global parameters (GP) you have to set them up first before making parts. You then associate your GP with your part and the values in your GP show in the equation editor as fields you can reference. is D1 = GP-D1.
Having said that, yes you can script GP values.
I have an assembly of a fabricated gear blank. It has a hub, a central plate and a rim.
My script asks for values for the GP which it updates and then does a regenerate on the assembly and the 3 parts resize accordingly to make the gear with the desired fits for welding. I have designed a template assembly and do a SaveAs each time to keep all the names simple without needing to be changed.
 

R-man

Senior Member
Thanks Albie.

So you are building a part "by hand" with values from the equation editor. Then in a script you are getting user input to update the GP and regenerating the part. (Correct me if I'm wrong!).

I create and build all my parts via scripts, adding lines, circles, etc, (and extrusions etc) using variables that are initiated in a separate parameters-script via execfile(). If I want to modify the part (or assembly), I modify the parameters-script and re-run the appropriate script to rebuild.

When posting my question I did not realize that regenerating the part was a necessary step. ( I thought it worked by "spooky action at a distance", like entangled electrons! ) With that naive understanding I was ready to change my process, but now I see that what I do is not so different except that where you regenerate the part or assembly, I would re-build the part or assembly.
 

idslk

Alibre Super User
Hello r-man,

are you talking about the values in the Equation Editor, which are created automatically during sketching (and of course they can be made manually too) or are you talking about the values coming from the "external" GLP-File?
upload_2020-7-10_21-9-8.png

Regards
Stefan
 

R-man

Senior Member
Hi Stefan,

Thanks for your reply.

Good question . . . because I don't know. I've never used either. And now that I've played around a bit it seems the equation editor brings up what I put into the GP file. I'm completely ignorant as to the difference and know little about either.

I can best express what I'm trying to do with a basic example.

The script I just finished has the statement ftCo2 = P2.AddExtrudeBoss('ftCo2', skCo2, PuFlTh, True ) .
If I was doing this manually I could choose a value for PuFlTh using the equation editor. There is a drop-down of the various sources of parameters. One of them is Global Parameters. I gather that if PuFlTh was one of the global parameters that I could use it, and then changes made to it after the fact would be reflected in the part upon regenerating.

upload_2020-7-10_23-31-44.png

When scripting an extrusion (for example) I would like to similarly choose an externally held value via something like the equation editor, such that subsequent changes in the external value would be reflected in the part upon regeneration.

Is that possible?
 

R-man

Senior Member
Hi Stefan.

I just noticed your post of a script that opens a GLP file in a script! Would that give me the capability that I have described in the previous post?
 

NateLiquidGravity

Alibre Super User
Global Parameters are for Alibre Design to automatically make changes happen across MULTIPLE parts and assemblies when the Global Parameter file is changed. Idk if that requires loading files regen and save before changes make it to drawings?

If you're changing them by script then Global Parameters seem kinda redundant to me.
 

idslk

Alibre Super User
Hello @R-man ,

EE is used for variables stored inside a design.
GP is used for variable stored in a seperate file to be used in multiple designs.
If you get values from an alibre script input window or calculation within a design, you can use a *.AD_GLP file to store these for use with other designs.
I've made a short script to print EE-variables of a design (part or assembly) and added a few lines to the "Open_a_GLP-file" script to print these variables too.
The scripts are not very "sophisticated", but should be enough to have a startpoint...

Regards
Stefan
 

Attachments

  • Print_EE_Variablen_R_man.py
    946 bytes · Views: 11
  • open_glp_window_R_man.py
    2.9 KB · Views: 13
GP is used for variable stored in a seperate file to be used in multiple designs.
If you get values from an alibre script input window or calculation within a design, you can use a *.AD_GLP file to store these for use with other designs.
Hi Stefan -- To be clear the term Global is inaccurate as the term Project would be much better. Global implies that it applies to everything. It is much better to think of it as consisting of those Variables that apply across a Project. -- Lew
 
i do not have used the word "GLOBAL" nor the word "PROJECT"!
Hi Stefan -- I object to the misuse of terms contained in the abbreviation "glp" (which stands for Global Parameters) as they are neither Global (as defined above) nor Parameters in the mathematical sense. As we are Designers who presumably understand the mathematics of Design, I object to such misuse. -- Lew
 

simonb65

Alibre Super User
I never use the term project for an Alibre design, a project to me is a bigger, more encapsulating entity which includes many designed parts and also includes the integration or end soulution those parts are made for! I would personally call them Global Design Parameters or Properties, each to their own.

In software, global is referred to something (i. A variable) that is accessable by every software module thag makes up that software application. Thats its boundry. Without a definition of those boundaries, or how Alibre entities are bound in relation to each other, its hard to say what is right or wrong.

Issue is that different working practices use the same words to define different boundaries. So the words are just that ... words! Just my 2p
 

R-man

Senior Member
Global Parameters are for Alibre Design to automatically make changes happen across MULTIPLE parts and assemblies when the Global Parameter file is changed. Idk if that requires loading files regen and save before changes make it to drawings?

If you're changing them by script then Global Parameters seem kinda redundant to me.

I described a simple situation so I could clearly communicate what I wanted to do within a script, but in fact I have many parts in my project that share the same parameters. So I was really talking about having access to the GLP while scripting a new part within the project.

Right now I simply use execfile to run my own project wide parameters file in each part script. About redundancy . . . if I change a variable value I need to re-run the affected scripts, if I were using GLP and changed a variable I would need to regenerate the affected parts. So I agree it doesn't look like there is any big benefit to changing my system. But I'm still curious to discover what is possible.
 

HaroldL

Alibre Super User
Lew, why don't you put all your objections in your signature, that way you wouldn't have to repost them every time someone has a comment about Global Parameters.:)
Besides, we on the forum can do nothing about what Alibre calls them and I for one will use the terms that Alibre assigns to them. Maybe your argument should be with Alibre instead of the users on the forum.
 
Besides, we on the forum can do nothing about what Alibre calls them and I for one will use the terms that Alibre assigns to them. Maybe your argument should be with Alibre instead of the users on the forum.
And, Harold, I assure you that the people at Alibre have heard my "screaming" on this subject for years. Whereas all Parameters are Variables not all Variables are Parametric. We, the "design crowd, should be clear as to these definitions. -- Lew
 

oldfox

Alibre Super User
To be clear the term Global is inaccurate as the term Project would be much better.

Opinion. Not fact.

I object to the misuse of terms contained in the abbreviation "glp"

And? I personally have no objections.

Whereas all Parameters are Variables

From Merriam-Webster > 1a : an arbitrary constant whose value characterizes a member of a system

Maybe you should be taking this up with Mr. Jacob if you want anything changed.

JMHO
 
From Merriam-Webster > 1a : an arbitrary constant whose value characterizes a member of a system

Hi Oldfox -- A Parametric Value is either (A) generated through independent (and possibly multiple) external equations or (B) by accepting variable data from external database(s). Should thos conditions not apply, then you are dealing with a plain Variable Value. It is that simple (but you need to look into a mathematical text or reference to find the correct definition). -- Lew
 
Top