Welcome to the COE Discussion Forums! 

 

To participate in the discussion forum, you must be logged in to the website.  If you forget your login information, please contact COE Headquarters at coe@coe.org or (800) 263-2255.

If you are new to the COE Discussion Forum and would like to participate, please register.


COE Community News

Follow COE on

COE DISCUSSION FORUM
Parameter identification
Last Post 08 Jul 2009 03:45 AM by Mowgli_70. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Mowgli_70
New Member
New Member
Posts:9

--
02 Jul 2009 08:47 AM  

Hello!

I have an assembly and some components (CATPart or CATProduct) have, among other user defined properties, a parameter called "My_Parameter". Let it's value be "The part is mine."

I would like to know which is the most convenient way to identify this parameter for a given component (or better said, to identify the component which posses this parameter). I know that there is a Parameter collection for the Product object and one solution would be to parse the tree recursively and for each component to loop through his collection of parameters until a match is find. Is there a better solution?

I would be grateful if someone could post a code snippet showing me how to identify this parameter.

MBERRY
Basic Member
Basic Member
Posts:470

--
06 Jul 2009 07:16 AM  
I think your method is good, but you don't have to loop thru the parameters collection to find a specific one, just disable error handling and try to get the parameter by name, then check for an error. That will save you a bit of time.

On Error Resume Next
Set objParam = objParameters.Item("My_Parameter")
If Err.Number = 0 Then 'If 0 then the parameter was found...

Also, a recursive method like you suggested is useful in order to check whether the instances are at least partially loaded. If they are not (in full visualization mode) you can't get at the user def props. So your code could check this then do a partial load on each if needed...

Mike
Increase your CATIA V5 programming skills
v5vb.wordpress.com
Mowgli_70
New Member
New Member
Posts:9

--
08 Jul 2009 03:45 AM  

Dear Mike -

Thank you very much for the answer. It's helped me a lot.

Best regards,

Mowgli_70

You are not authorized to post a reply.

Active Forums 4.1