Inventor General Discussion

Inventor General Discussion

Reply
Active Member
Liocor
Posts: 8
Registered: ‎05-08-2012
Message 1 of 7 (219 Views)
Accepted Solution

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

219 Views, 6 Replies
05-11-2012 05:00 AM

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 :smileyhappy: 

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

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

*Expert Elite*
mrattray
Posts: 2,501
Registered: ‎09-13-2011
Message 2 of 7 (216 Views)

Re: Is a vba search descriptor to get only part containing 3D solid in a assembl

05-11-2012 05:40 AM 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

Active Member
Liocor
Posts: 8
Registered: ‎05-08-2012
Message 3 of 7 (214 Views)

Re: Is a vba search descriptor to get only part containing 3D solid in a assembl

05-11-2012 05:46 AM 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 ?

*Expert Elite*
mrattray
Posts: 2,501
Registered: ‎09-13-2011
Message 4 of 7 (210 Views)

Re: Is a vba search descriptor to get only part containing 3D solid in a assembl

05-11-2012 05:58 AM 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

Active Member
Liocor
Posts: 8
Registered: ‎05-08-2012
Message 5 of 7 (206 Views)

Re: Is a vba search descriptor to get only part containing 3D solid in a assembl

05-11-2012 06:10 AM in reply to: Liocor

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

*Expert Elite*
mrattray
Posts: 2,501
Registered: ‎09-13-2011
Message 6 of 7 (203 Views)

Re: Is a vba search descriptor to get only part containing 3D solid in a assembl

05-11-2012 06:16 AM 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

Active Member
Liocor
Posts: 8
Registered: ‎05-08-2012
Message 7 of 7 (201 Views)

Re: Is a vba search descriptor to get only part containing 3D solid in a assembl

05-11-2012 06:20 AM in reply to: Liocor

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

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.