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: 

How to scale objects in sketch?

1 REPLY 1
Reply
Message 1 of 2
ArjanDijk
304 Views, 1 Reply

How to scale objects in sketch?

I tried to edit the supplied example from the API help for moving objects to scale a sketch. Not sure how to do this. This method only moves the object and does not scale. Any ideas how to solve this? 

 

Is Scaleby the appropriate method? It only seems to scale the vector of movement.

 

Public Sub MoveAndSkaleSketchObjects()
    ' Check to make sure a sketch is open.
    If Not TypeOf ThisApplication.ActiveEditObject Is sketch Then
        MsgBox "A sketch must be active."
        Exit Sub
    End If

    ' Set a reference to the active sketch.
    Dim oSketch As sketch
    Set oSketch = ThisApplication.ActiveEditObject
    
    ' Create a vector along the x-axis.
    Dim oVec As Vector2d
    Set oVec = ThisApplication.TransientGeometry.CreateVector2d(0.1, 0)
    Call oVec.ScaleBy(5) 'scale this vector by 5
    
    Dim oSketchObjects As ObjectCollection
    Set oSketchObjects = ThisApplication.TransientObjects.CreateObjectCollection
    
    ' Get all entities in the sketch
    Dim oSketchEntity As SketchEntity
    For Each oSketchEntity In oSketch.SketchEntities
        oSketchObjects.Add oSketchEntity
    Next
    
    ' Move all sketch objects along x-axis by 5 units.
    ' This will move all the text boxes and images in
    ' the sketch as well since these have sketch lines
    ' as boundary geometry or a sketch point as an
    ' origin point.
    Call oSketch.MoveSketchObjects(oSketchObjects, oVec)

End Sub

 


Inventor HSM and Fusion 360 CAM trainer and postprocessor builder in the Netherlands and Belgium.


1 REPLY 1
Message 2 of 2
YuhanZhang
in reply to: ArjanDijk

Unfortunately we have not the Scale function for sketch entities exposed to API yet, and I don't see any workaround for it.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report