potrero
Mechanical
- Aug 30, 2007
- 516
In working with Drafting Templates (and using the master model method, where the master model is the only component of the drawing), it would be quite useful to programmatically access the name of the master part. This, for instance, could then be used to set the value of the "DB_PART_DESC" attribute in the drawing file.
For example, let's say the master part name is: "123456.prt", and let's say it has a description attribute, "DB_PART_DESC" set to "COVER PLATE".
If one could use Knowledge Fusion or some other programmatic means to obtain a string of the master part name, then you could very easily use Knowledge Fusion to then access the DB_PART_DESC parameter of the MASTER part as follows:
ug_askAttrValue_("123456.prt", "PART_ATTRIBUTE", "DB_PART_DESC")
If the programmatic means to access the master part name had allowed creation of a parameter, then this would be even nicer, and could be implemented in the Expression Editor as:
master_name = 123456.prt
DB_PART_DESC_Attribute = ug_setPartAttrValue ("DB_PART_DESC", ug_askAttrValue_(master_name, "PART_ATTRIBUTE", "DB_PART_DESC"))
where the variable, "master_name" is of String type, and "DB_PART_DESC_Attribute" is of Integer type.
Now, I've tried a number of ways to obtain the Master part name with KF; for example:
1. asm_struct = ug_askAssemblyStructure("");
this yields a list, which appears to have the master part name string as the second level. But, then, how do you access this string?? In looking through the available List KF functions, I can't find one that will spit out the master part name. For instance, first({asm_struct}) just returns "asm_struct"; and second({asm_struct}) returns NoValue. Argh.
2. It would seem that the Automatic Text functionality in drafting templates might be useful... the function, <W@$SH_MASTER_PART_NAME> seems to do exactly what I want, except that I can't figure out how to access this string for use in any other formulas, such as above. Also, I can't figure out how to access Automatic Text inside Knowledge Fusion.
So, if anyone has any ideas or can help, it'd be great! Thanks.
For example, let's say the master part name is: "123456.prt", and let's say it has a description attribute, "DB_PART_DESC" set to "COVER PLATE".
If one could use Knowledge Fusion or some other programmatic means to obtain a string of the master part name, then you could very easily use Knowledge Fusion to then access the DB_PART_DESC parameter of the MASTER part as follows:
ug_askAttrValue_("123456.prt", "PART_ATTRIBUTE", "DB_PART_DESC")
If the programmatic means to access the master part name had allowed creation of a parameter, then this would be even nicer, and could be implemented in the Expression Editor as:
master_name = 123456.prt
DB_PART_DESC_Attribute = ug_setPartAttrValue ("DB_PART_DESC", ug_askAttrValue_(master_name, "PART_ATTRIBUTE", "DB_PART_DESC"))
where the variable, "master_name" is of String type, and "DB_PART_DESC_Attribute" is of Integer type.
Now, I've tried a number of ways to obtain the Master part name with KF; for example:
1. asm_struct = ug_askAssemblyStructure("");
this yields a list, which appears to have the master part name string as the second level. But, then, how do you access this string?? In looking through the available List KF functions, I can't find one that will spit out the master part name. For instance, first({asm_struct}) just returns "asm_struct"; and second({asm_struct}) returns NoValue. Argh.
2. It would seem that the Automatic Text functionality in drafting templates might be useful... the function, <W@$SH_MASTER_PART_NAME> seems to do exactly what I want, except that I can't figure out how to access this string for use in any other formulas, such as above. Also, I can't figure out how to access Automatic Text inside Knowledge Fusion.
So, if anyone has any ideas or can help, it'd be great! Thanks.