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 pick up center for circle VBA?

1 REPLY 1
Reply
Message 1 of 2
AndreyBTRDQ2
58 Views, 1 Reply

How to pick up center for circle VBA?

Hello, kindly ask to help in code for making circle. I want to get a macros, that would create new sketch with project geometry from all existing sketches and would built a circle from a point, that i pick up by cursor. Radius of circle for example is 1 (in really i don't care on this stage, I just need to have method to choose center of this circle).  Thank you

1 REPLY 1
Message 2 of 2
A.Acheson
in reply to: AndreyBTRDQ2

Hi @AndreyBTRDQ2 

See one of the API samples here. The code below is the top half of the macro. I suggest if you need further helps with these sketches that you have a look through the samples. You will be able to identify a nice few methods for different objects. 

    ' Create a new part document, using the default part template.
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
    ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))

    ' Set a reference to the component definition.
    Dim oCompDef As PartComponentDefinition
    Set oCompDef = oPartDoc.ComponentDefinition

    ' Create a new sketch on the X-Y work plane.
    Dim oSketch As PlanarSketch
    Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(3))

    ' Set a reference to the transient geometry object.
    Dim oTransGeom As TransientGeometry
    Set oTransGeom = ThisApplication.TransientGeometry

    Dim oCenter As Point2d
    Set oCenter = oTransGeom.CreatePoint2d(-5, 0)

    ' Create a sketch circle
    Dim oCircle As SketchCircle
    Set oCircle = oSketch.SketchCircles.AddByCenterRadius(oCenter, 1)

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report