Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is a vba search descriptor to get only part containing 3D solid in a assembly ?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Liocor
629 Views, 6 Replies

Is a vba search descriptor to get only part containing 3D solid in a assembly ?

Hi, I'm out of idea to create a search criteria to get only the part in an assembly with contain 3D solid. I created a vba code to get all the coordinates off COG in a assembly but no way found yet to exclude a part that always existing in the assembly with contains only 3D sketches, no 3D datas and I'm must always delete this part on assembly before running the macro if not, the macro stop when trying to get datas on this part. If one have an idea, would be very helpfull 🙂 

6 REPLIES 6
Message 2 of 7
mrattray
in reply to: Liocor

I'm not really following your workflow, but if you just need to skip a certain part couldn't you just put some kind of unique flag on it and use an if then block to check for the flag? I'm thinking custom iProp.

Mike (not Matt) Rattray

Message 3 of 7
Liocor
in reply to: Liocor

The Assembly name and part will change everytime...the only thing constant will be the word "layout" in the display name of the part I have to delete to run properly the macro.

 

Is there a way to skip the part with this flag ? King of vba command that check if the display name contains the word "layout" int the part displayname and skip it in the loop ?

Message 4 of 7
mrattray
in reply to: Liocor

It's hard to say without knowing how your going about what your doing, but I'll try.

Is "layout" always in the same spot in the name? i.e. always at the end like "my layout" or the begining? If not, the only way I know of hand is to loop through the name of every part which might get slow if you have a ton of parts.

You might use something like:

 

For/Do/Whatever...

if right(varibaleHoldingPartName,6) <> "layout" then

whatever your doing

end if

next

 

-or-

 

For/Do/Whatever...

skip = false

for i = 6 to len(varibaleHoldingPartName)

if left(right(varibaleHoldingPartName,6),i) = "layout" then

skip = true

end if

next

if skip = false then

whatever your doing

end if

next

Mike (not Matt) Rattray

Message 5 of 7
Liocor
in reply to: Liocor

I could impose to create the part always begining by SEAT_LAYOUTxxxxx.ipt

Message 6 of 7
mrattray
in reply to: Liocor

Then simply do a check on the displayname property like in my first example.

if left(displaynamevariable,11) <> "SEAT_LAYOUT" then

your code

end if

Mike (not Matt) Rattray

Message 7 of 7
Liocor
in reply to: Liocor

That's what I did, it works. Thanks to help me to simplify my workflow 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report