What's new

Editing a Part in an Assembly

Hello everyone,

I'm trying to change the length of a part in my assembly. I would like to steer clear of configurations, because I need the part to be able to be any length. Currently I have the length linked to a global parameter, which I am able to change in a script, but the length will not change unless I click "update design" in the global parameters file. Having to click the global parameters file basically negates what I'm trying to do with the script anyway, so I am looking for a way around this. I havet thought of 3 options which I am not able to find ways to do:
  1. Update the global parameters file with a line or two of code
  2. Edit the part in a separate window, close the window, and refresh the assembly
  3. Edit the part's extrusion value directly in the assembly
Number 3 seems like it would work the best, but I am not a programmer and I have not found any example code online on how to do any of these 3 options. Does anyone have a shortcut they have used to get around this problem in the past?
 
I'm trying to change the length of a part in my assembly. I would like to steer clear of configurations, because I need the part to be able to be any length. Currently I have the length linked to a global parameter, which I am able to change in a script, but the length will not change unless I click "update design" in the global parameters file. Having to click the global parameters file basically negates what I'm trying to do with the script anyway, so I am looking for a way around this. I havet thought of 3 options which I am not able to find ways to do:
Hi Brandon -- But how do you distinguish between (say) "Length 50mm," "Length 75mm," and "Length 100mm" in different applications? It may begin with (say) a "specific extrusion," but each different Length is a different Part that requires it's own Identity in terms of "Process Management," correct? -- Lew
 
Hi Brandon -- But how do you distinguish between (say) "Length 50mm," "Length 75mm," and "Length 100mm" in different applications? It may begin with (say) a "specific extrusion," but each different Length is a different Part that requires it's own Identity in terms of "Process Management," correct? -- Lew

Hi Lew,

Not necessarily. The part itself will always remain constant at the ends. The middle can be as long as need be, and the total assembly is defined by how long the part is. We make many many different lengths for customers and it would be altogether easier for everyone involved if each different length assembly was not another configuration and was instead an option in a script.

We can cut our extrusions to any length required. This is mostly a time-saving project on getting models prepared quickly and accurately with multiple different people using the same assembly file.
 
Not necessarily. The part itself will always remain constant at the ends. The middle can be as long as need be, and the total assembly is defined by how long the part is. We make many many different lengths for customers and it would be altogether easier for everyone involved if each different length assembly was not another configuration and was instead an option in a script.
Hi Brandon -- But do not differing lengths require different documenation to assure your customers that they have gotten what they ordered? [Now, mind you I live in a world typically "governed" by MIL, NAS, or equivalently detailed requirements.] -- Lew
 
Hi Brandon -- But do not differing lengths require different documenation to assure your customers that they have gotten what they ordered? [Now, mind you I live in a world typically "governed" by MIL, NAS, or equivalently detailed requirements.] -- Lew

Hi Lew,

This is not the final process to making sure the customers are getting what they need. Further down the road there are other processes. One important service of this script will be to quickly allow salespeople to create custom models for customers. The documentation in this script is irrelevant. I am only curious how to selectively edit parts within an assembly script.
 

NateLiquidGravity

Alibre Super User
Code:
Units.Current = UnitTypes.Inches
Assem = CurrentAssembly()
Prt = Assem.GetPart('New Part (1)<1>')
ParamD1 = Prt.GetParameter('D1')
print('Original Value: ' + str(ParamD1.Value))
ParamD1.Value = 10
print('New Value: ' + str(ParamD1.Value))
 
Last edited:
Code:
Units.Current = UnitTypes.Inches
Assem = CurrentAssembly()
Prt = Assem.GetPart('New Part (1)<1>')
ParamD1 = Prt.GetParameter('D1')
print('Original Value: ' + str(ParamD1.Value))
ParamD1.Value = 10
print('New Value: ' + str(ParamD1.Value))

Nate to the rescue! Thanks again!
 

MCATI

Member
Prt = Assem.GetPart('New Part (1)<1>')
This is amazing, how you find this script, "GetPart", I never find it in help file ...
 

NateLiquidGravity

Alibre Super User
When it comes to Alibre Script there's the help, the reference manual, and the advanced API documents located in the Alibre Script add-ons folder.
 
Top