Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Changing Layers of MultiBody Parts

0 REPLIES 0
Reply
Message 1 of 1
petestrycharske
281 Views, 0 Replies

Changing Layers of MultiBody Parts

All,

 

I am extremely new at iLogic and have greatly benefited from the forum posts that I have perused.  To set the stage, I work a lot with the Factory Design Suite and so most of my parts are multiple solid body parts that represent the factory equipment.  I have seen a few different posts on how to assign layers into parts of an assembly within the Inventor drawing.  However, I am wondering if there is a way to reach into a part file, check each solid body name and then assign that linework to a specific layer in the drawing.

 

My approach thus far has been to create a part with multiple solid bodies and name each body specifically.  I have also created a drawing template with the layers that I want to use.  Now I just need to be able to tie the two together.  Can anyone point me in the right direction?  Don't laugh, but here is what I have so far...

 

'Define the variables
Dim drawDoc As Drawing Document
drawDoc = ThisApplication.ActiveDocument
Dim dSheet As Sheet
Dim drawView As DrawingView
'LayersEnumerator creates a set of layers
Dim layers As LayersEnumerator
'Create the Layer object as the type Layer
Dim oLayer As Layer
'Create the Part object as the type PartComponentDefinition
Dim oPart as PartComponentDefinition
'Create the SolidB object as the type SurfaceBody
Dim oSolidB as SurfaceBody

Dim odCurve As DrawingCurvesEnumerator

''Set the layers to cover everything in the Style Manager
'layers = drawDoc.StylesManager.Layers

For Each dSheet In drawDoc.Sheets
    For Each drawView In dSheet.Views
        For Each oSolidB In oPart.SurfaceBodies
            If oSolidB.Name = Layer.Name Then
           

At this point, I am less concerned about the looping (just have to put the time into learning how that all works), but want to know how to tie the linework to the SolidBody.  Forgive the rudimentary code (and feel free to offer corrections).  If you have any questions, please do not hesitate to contact me.  Hope all is well and have a most blessed day!

 

Peace,

Pete

Just a guy on a couch...

Please give a kudos if helpful and mark as a solution if somehow I got it right.
0 REPLIES 0

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

Post to forums  

Autodesk Design & Make Report