Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Register Log in

Checking if component exists in assembly

conrat

New member
Hi there,





I was wondering if anyone knows how to check to see if a component exists in an assembly, prior to accessing it.





For instance, if a part is assembled to the model based on if a certain
parameter is true, is there a way to check if that component is in
session when writing relations? Something like:





if component exists<br style="color: rgb(255, 0, 0);">

hole_dia from component = .5





Also, is there a way of doing this for features in a part as well?





if feature exists<br style="color: rgb(255, 0, 0);">

hole_dia = .5





or





if feature is not supressed<br style="color: rgb(255, 0, 0);">

hole_dia = .5





The problem I have is, I can access feature values in an assembly from
a part, but if that component is supressed, I get errors in my
relations if I edit the relations while the part is supressed. I
also get "invalid symbol" errors under similar circumstances.





Thanks in advance


Jim



ps - I also accidentally posted this in the part modeling forum. Sorry.
 

Isair

New member
Huh I'm not sure but I think that it isn't possible to have control of is someone component, or feature suppress, but yours problem can be solved different way.
I suppose that when certain component are suppressed, that means that this is one type of construction, or version, and when are other component supressed, then its other. So I would create parameter which will have version type as its value, then you be able to create loop which will be controlled by this parameter, and then you be able to make relations with both dimension of suppressed component/feature in that if loop.
For example:


IF VERSION=="a type"
hole_dia=d8:6
ELSE
IF VERSION=="b type"
hole_dia=d7:12
ENDIF
ENDIF

Where d8:6 is dimension from one of the component
Hope it helps
 

conrat

New member
Isair,



I tried to do something similar to this, but still get errors.



Here is an example of where this becomes a problem. I have an assembly, where depending on if the parameter WALL_CON == "S" or not, I will have a subassembly that has the parameter QTY_POP_RIVETS.



QTY_POP_RIVETS is the qty of holes in a pattern from the component.



However, if I use this relation:



IF WALL_CON == "S"<br style="color: rgb(0, 102, 255);">
QTY_POP_RIVETS = QTY_POP_RIVETS:421<br style="color: rgb(0, 102, 255);">
ENDIF



...and the subassembly is not in session (ie - surpressed), I get the following error when editing relations:



IF WALL_CON == "S"<br style="color: rgb(0, 51, 255);">
QTY_POP_RIVETS = QTY_POP_RIVETS:421<br style="color: rgb(0, 51, 255);">
/* ERROR: Invalid symbol 'QTY_POP_RIVETS:421' found. <br style="color: rgb(0, 51, 255);">
ENDIF



The only way to stop this is to open the subassembly which has been supressed and once in session, I do not get the error.<br style="color: rgb(0, 0, 0);">
<br style="color: rgb(0, 0, 0);">
The problem with this is that if I
use this method on a 100 or 200 parts or subassemblies, I would need to
sit and open each supressed component first, before editing relations,
to ensure they are in session.<br style="color: rgb(0, 0, 0);">
<br style="color: rgb(0, 0, 0);">
If there was a way to check if it
was in session or supressed and skip the logic statement if it is, I
think this problem would go away.<br style="color: rgb(0, 0, 0);">
<br style="color: rgb(0, 0, 0);">
OR....<br style="color: rgb(0, 0, 0);">
<br style="color: rgb(0, 0, 0);">
Is there a config.pro option or
something that retrieves all supressed subassemblies into session (even
though they are supressed) when opening a model? This would
probably fix the problem as well.<br style="color: rgb(0, 0, 0);">
<br style="color: rgb(0, 0, 0);">
Any ideas? I appreciate your prompt response. I didn't expect an answer so soon.<br style="color: rgb(0, 0, 0);">
<br style="color: rgb(0, 0, 0);">
Thanks again,<br style="color: rgb(0, 0, 0);">
Jim
 

Isair

New member
I have tried in a small assm, that what you are telling me and for me it works. I have created small asm, with several components, then in one of component I have created parameter QTY_HOLE, and put it in relation QTY_HOLE=P4 (where p4 is number of patterned holes in part). After that in my asm. I have created new parameter QTY_HOLE, put it in relations and connect that relation to part paymaster: QTY_HOLE=QTY_HOLE:8. Then I saved it all, suppressed this part in which is parameter, and again save asm, closed it, and erase it from session. After that I opened it again, go to relations, check it and everything was OK regarding that component was suppressed.
Well I didn't tried doing that with subasm, I didn't have time to do that. About config options only thing I have come across is this:
exec_prog_on_assem_retr yes
Try with that, if that doesn't help we will try something different then.
Edited by: Isair
 

conrat

New member
Isair,



Once again thank you for your assistance. The only thing different between what I am doing and what you are doing is my QTY_POP_RIVETS:421 references
a dimension symbol (ie - DimCosmetic -> Symbol), not a parameter per
se. Looks like I was not clear in my last post. Maybe this
is the problem I am running into.



I like to name my dimension and reference them directly, rather than writing relations like "MY_PARAM = D0", as I find the references to unnamed dimension confusing and harder to track down when revising a model.



I will try setting a parameter in my subassembly to reference the
dimension name, instead of trying to access it directly, and see if
this works. I will let you know how I make out.



Thanks again,

Jim
 

Isair

New member
Sorry for my misunderstanding. I have tried like you said, change dimension name, put that in relation in asm, suppress that component and again it work for me. Then I tried with subasm, suppress that component it subasm and again it work (and I tried with suppressed subasm).
But then I must noticed that my suppressed component (even if it is suppressed, saved, clear from session, opened again) is in session, when I open asm in which is written relation. I'm using wildfire 2.0
So maybe there is config options, i will look for it tomorrow.
 

conrat

New member
The thing that I don't understand is, I am using an EXECUTE statement
to pass my parameter values from the top level assembly to the lower
level subassembly. You would think that would call the subasm
into session during the execute statement.



I will set up a small asm like you did and see if it works. If it
does, it must be something else in this model. I will let you
know if I get similar results.



Thanks again,

Jim
 

conrat

New member
Isair,



I am not sure what my problem is, but I think I may have my component
references wrong somehow. This is the only way I could re-create
the error. I created a small asm and it worked fine until I moved
the reference to the part in the subasm. Also, as long as my
references were correct, it didn't matter if it was a symbol reference
or parameter reference or if the feature was in the part or subasm.



I think I will need to re-investigate my model to see if I can see where this problem is. It looks like a EBKC (Error Between Keyboard and Chair) Thanks for your help. I will let you know when I fix it and what the problem was.



Thanks again,

Jim
 

Isair

New member
I'm glad that could be of assistance.
I would suggest to you that you use Layout in this kind of construction type, because then you got better control and hierarchy of parameters and relations. All main parameters are stationed in layout, and when you declare layouts to asm, and parts they exist in all declared asm and parts, so then you don't have confusion where some parameter is created, and execute of program is alway from layout to asm and parts. Also is easier to control all input parameters for users.
 

conrat

New member
Isair,



This is a model that was programmed by the guy whom I replaced.
He never really bothered delving into top down design. Some of
these models are nightmares, with numerous external references (read:
regen failures).



I considered using layouts on a new model I am working on, but am not sure how to read in a file to a layout.



See, we use a VB "frontend" for the parameters. A user enters
information into a VB program, which generates a text file that can be
read into Pro/E (Regen...Auto...Read File...). We do this because
there are such a number of user entered parameters (and some values are
calculated in VB) that it is confusing to answer them via Pro/E.
We also get the added benefit to calculate values and even pull some
values from our ERP system.



Do you know if there is a way to read an external file into a
layout? I do not have the option when in a layout, although I do
in an assembly.



Thanks,

Jim
 

Isair

New member
Huhthe thing that someone else modeled and programmed this model you have explain trouble you have, and I believe you when you said that this model is nightmare



I don't know for sure but I think that there aren't way to read external file into layout. Unfortunately layouts, and pro/program aren't to many updated from one to antihero version of Pro/E, thats bad because this is a great option of Pro/E and should be better.
I know that something familiar what you are using VB program to create external file and then use it in asm can be created trough J-link, and then you got more freedom in relations and parameters, but I didn't have time to spend on learning J-link.
 

conrat

New member
Isair,



The funny thing is he went to nearly all of the PTC courses. I
guess not much sunk in. I have only went to a few basic training
classes, but because I love Pro/E, have spent much of my time learning
new things. Top-down design is a no-brainer when you start
looking at many parts being swapped in and out of an assembly.
Nothing is worse than having a model fail because a hole in a part was
referenced for another hole in another part, but the referenced part is
supressed. I have spent way too much time in Failure Mode.



I know some basic programming, but no Java, which is required for
J-Link. However, I do plan to start learning as much as I can, so
maybe I will be able to offer help in the future.



Thanks for all of your help,

Jim
 

Isair

New member
No problem, glad I could help



I have also basic training of Pro/E, foreverything else they give me tutorials and then I learned myself everything else. Yes I know what beauty is when someone reference some feature to external references, then you must search where he put it, why he put it there, and then remodeled this feature because old way was to wrong (and yes lose to many time to do that).
Hope you would successfully finish this work without loosing to many nerves

About that Java and J-link, if my company decide to next project would be worked trough using J-link then I will also must learn that, and if not then only if I would have time to spend learning it.
If you have any more questions just ask
 

Sponsor

Top