Inventor Customization

Reply
Contributor
tomjames3d
Posts: 12
Registered: ‎03-01-2007
Message 1 of 2 (120 Views)

SketchBlock Position

120 Views, 1 Replies
08-29-2012 10:35 AM

I have a sketchblock in a sketch that I need to postion into the correct quadrant. I have dimensions on the sketchblock that are told to be driven while running the quadrant position task shown below. see image. Sketchblock is currently in quadrant 1 and I need to be able to push that into the 3rd, thus the (-200,-200).

 

ThisApplication.ActiveDocument.ComponentDefinition.Sketches(1).SketchBlocks.Item(1).Postion.X = -200

ThisApplication.ActiveDocument.ComponentDefinition.Sketches(1).SketchBlocks.Item(1).Postion.Y = -200

 

After it is in the correct quadrant I power the dimensions to constraint the sketchblock into correct position.

 

The question is, how do I position the sketchblock in the correct quadrant via 'position'?

 

Not working.

ADN Support Specialist
Vladimir.Ananyev
Posts: 457
Registered: ‎08-14-2012
Message 2 of 2 (103 Views)

Re: SketchBlock Position

09-02-2012 11:23 PM in reply to: tomjames3d

This method works in your case:

Sub MoveBlock()

  Dim oDoc As PartDocument
  Set oDoc = ThisApplication.ActiveDocument

  Dim oDef As PartComponentDefinition
  Set oDef = oDoc.ComponentDefinition
  
  Dim oSketch As Sketch
  Set oSketch = oDef.Sketches.Item(1)
  
  Dim oBlock As SketchBlock
  Set oBlock = oSketch.SketchBlocks.Item(1)
  
  Dim oP As Point2d
  Set oP = oBlock.Position
  
  oP.x = oP.x + 1
  oP.y = oP.y + 1
  
  oBlock.Position = oP
  oSketch.Solve

End Sub

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

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 to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube