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: 

Need help with VBA code

1 REPLY 1
Reply
Message 1 of 2
fakeru
207 Views, 1 Reply

Need help with VBA code

Hi

I got stuck with my code at the point where I want to get access to the occurrence that has a DrawingCurveSegment selected by user with Pick method. So the user selects the edge of a part in drawingview and based on that drawingcurvesegment Inventor must color all the occurence drawing curves using DrawingCurve.Color.

To reach all the drawingcurves of that occurrence I need to get the occurence. But how do I do that? Any ideas?

 

Thanks

Alexandru

 

Autodesk Inventor 2015 Certified Professional
1 REPLY 1
Message 2 of 2
t_remal
in reply to: fakeru

Hello,

 

You should be able to get the occurrence from ModelGeometry of the selected curve.

I was able to color the edges of an occurrence in an assembly view with this code:

 

    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument

    Dim oCurveSeg As DrawingCurveSegment
    Set oCurveSeg = oDoc.SelectSet.Item(1)
    
    Dim oCurve As DrawingCurve
    Set oCurve = oCurveSeg.Parent
    
    Dim oEdge As EdgeProxy
    Set oEdge = oCurve.ModelGeometry
    
    Dim oCompOccurrence As ComponentOccurrence
    Set oCompOccurrence = oEdge.ContainingOccurrence

    Dim oDrawingView As DrawingView
    Set oDrawingView = oCurve.Parent
    
    Dim oDrawingCurves As DrawingCurvesEnumerator
    Set oDrawingCurves = oDrawingView.DrawingCurves(oCompOccurrence)
    
    Dim oColor As Color
    Set oColor = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
    
    For Each oCurve In oDrawingCurves
        oCurve.Color = oColor
    Next

 

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

Post to forums  

Autodesk Design & Make Report