Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear,
Please refer to the attached sample image. I am copying the sketch from AutoCAD to the inventor. Sometimes it's coming in another direction. Hence, I want to rotate the sketch.
Secondly, I will pick any point that has to be constrained coincidently with the origin.
Please help me with ilogic code. This will save a lot of time for us.
I have tried with the below code for rotating the sketch, but not working.
'Rotate sketch
Sub main Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument Dim oDef As PartComponentDefinition = oPartDoc.ComponentDefinition Dim oPoint As Point = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Select a Point.") Dim oMoveFeatDef As MoveDefinition = oDef.Features.MoveFeatures.CreateMoveDefinition(oPoint) Dim oAxis As WorkAxis = oDef.WorkAxes.Item(1) oMoveFeatDef.AddRotateAboutAxis(oAxis, False, "90 deg") End Sub
'For adding Coincident Constraint with origin, This is also not working.
Sub main Dim oPartDoc As PartDocument = ThisDoc.Document Dim oFeatures As PartFeatures = oPartDoc.ComponentDefinition.Features Dim oCompDef As PartComponentDefinition oCompDef = oPartDoc.ComponentDefinition Dim pointA = ThisDoc.Geometry.Point(0, 0, 0) Dim PointB As Point = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPointEntities, "Select a Point.") Dim oSketches1 As PlanarSketches = oPartDoc.ComponentDefinition.Sketches oSketches1("WHBaseSketch").GeometricConstraints.AddCoincident(pointA, PointB) End Sub
Solved! Go to Solution.