cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Smart Assembly question

Jeroen
1-Newbie

Smart Assembly question

It is possible to get alle relations in a component of an assemble with this command:

GET_RELATIONS COMP_FEAT arrayOrigRelations

Now, because we have a piece of code that can be used for several different parts, we are trying to put this piece of code in a sub-tab file.

Everything works more or less, but COMP_FEAT is not known in this sub-tab.

How do I get these relations from within a sub-tab file?

We also want to remove relations from within this sub-tab.

The same problem here: REMOVE_FEATURE_RELATION COMP_FEAT --> comp_feat is an unknown parameter.

alternative (and better) solution would be the possibility to manually remove all component-relations from the current IDENT.

This is what we try to do with this piece of code.

Does this command exist?

3 REPLIES 3
sully7
13-Aquamarine
(To:Jeroen)

Jeroen,

Considering this post was a few months old, I hope you already found a solution.

If not, the way I usually do this is by using the CALL_EX function. So I'll save the commands I want in a new .tab file (make sure that file is also included in your sel_list.txt file as well), and then I will do something like this:

MAIN SCRIPT

--------

BEGIN_ASM_DESCR

! *** code above **

CALL_EX "lib:\\my_sub_function.tab"

VAR_IN COMP_FEAT COMP_FEAT

END_CALL_EX

! ** code below**

END_ASM_DESCR

-----------------------------

my_sub_function.tab

------------------------------

BEGIN_ASM_DESCR

DECLARE_ARRAY arrayOrigRelations

GET_RELATIONS COMP_FEAT arrayOrigRelations

FOR a_relation REF ARRAY arrayOrigRelations

REMOVE_FEATURE_RELATION COMP_FEAT

relation = &a_relation ! (NOTE: I'm not 100% how this function works, so double check it)

END_REMOVE_FEATURE_RELATION

END_FOR

END_ASM_DESCR

---------------------------------

Since COMP_FEAT is a feature (i'm assuming), you'll need to get an array of the relations. From there, you can isolate the element in the array that you are looking for, or you can do as I do above to iterate over all relations found. If you need to bring elemnts back into your main function, you can do so with a VAR_OUT.

As a side note, you don't have to keep the variable names the same between the two functions, I typically do though to try and keep everything consistant, but you needed, you can changing the variable mapping with VAR_IN.

To remove all relations from the current component, you SHOULD be able to simply use the REMOVE_RELATIONS command on your component:

DECLARE_REFERENCE DESIRED_COMPONENT

USER_SELECT COMPONENT DESIRED_COMPONENT

REMOVE_RELATIONS DESIRED_COMPONENT

All in all, the Admin guide will be your best friend during development. Although, I will admit that the documentation for the REMOVE_RELATION, REMOVE_RELATIONS, and REMOVE_FEATURE_RELATION commands is pretty miserable. Hopefully they'll get these cleaned up during the next revision!

Anyway, hope this helps!

Sully


President & Founder
CadActive Technologies - www.cadactive.com
Jeroen
1-Newbie
(To:sully7)

Hi,

We search from within the main tab file now. This way we have to copy this piece of code in every tab file where we wat to do this kind of search.

The reference COMP_FEAT (refering to the item last placed in an assembly, exists after the command ASSEMBLE THIS) is not known in the sub-tab and cannot be passed to the sub file (by my knowledge),so using a sub-tab is not possible in this case.


It still works fine if you have a model of feature reference, but not with a comp_feat reference.

The admin guide is opened from the moment I turn on my computer 😉

Smart Assembly is a very powerfull tool, but it lacks some fine-tuning and GUI-capability. Hopefully in a next release...

thanks,

Jeroen.

sully7
13-Aquamarine
(To:Jeroen)

Aah okay yes that makes much more sense then. Have you tried using COPY_REF?

You may be able to:

DECLARE_REFERENCE DESIRED_COMPONENT

COPY_REF COMP_FEAT DESIRED_COMPONENT

Then you could use CALL_EX and VAR_OUT as showed above to send the DESIRED_COMPONENT reference to a sub-tab, instead of using the COMP_FEAT automatic reference. But even with this method, you will still need to copy the CALL_EX code into every script, so it may just be faster to continue with the method that you are currently using.

And yes I agree completely. I've loved using it so far, but am definitely interested to see how it grows with future releases

Thanks,

Sully

President & Founder
CadActive Technologies - www.cadactive.com
Top Tags