Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 518

Inventor API to Redefine Work Features

$
0
0

by Vladimir Ananyev

The work feature collection objects – WorkPoints, WorkAxes, WorkPlanes – provide the wide range of Add methods to create corresponding work features in the part document. Autodesk Inventor API also provides a rich toolset for manipulating existing work features. In particular, you may redefine the existing work feature to re-associate it to another input geometry.

Take for example the work axis Axis1 in a part that was created by the intersection of two planes Plane1 and Plane2.

Ris_1

Workaxis.SetByTwoPlanes method allows you to redefine the Axis1 by specifying another pair of work planes – Plane1 and Plane3.

Sub RedefineWorkAxis()
  Dim oDoc As PartDocument
  Set oDoc = ThisApplication.ActiveDocument
  Dim oDef As PartComponentDefinition
  Set oDef = oDoc.ComponentDefinition
  Dim oAxis As WorkAxis
  Set oAxis = oDef.WorkAxes.Item("Axis1")
  Dim oPlane1 As WorkPlane
  Set oPlane1 = oDef.WorkPlanes.Item("Plane1")
  Dim oPlane3 As WorkPlane
  Set oPlane3 = oDef.WorkPlanes.Item("Plane3")
  Call oAxis.SetByTwoPlanes(oPlane1, oPlane3)
End Sub

Result:Ris_2

 

You may redefine work features from iLogic rule as well.
Here is the equivalent iLogic code:

'parent Part document
Dim oDoc As PartDocument =ThisDoc.Document
'part document definition
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition
'reference to the existing work axis
Dim oAxis As WorkAxis = oDef.WorkAxes.Item("Axis1")
'1st workplane
Dim oPlane1 AsWorkPlane= oDef.WorkPlanes.Item("Plane1")
'2nd workplane
Dim oPlane3 AsWorkPlane= oDef.WorkPlanes.Item("Plane3")
'redefine Axis1 to be at the intersection of planes 1 and 3
oAxis.SetByTwoPlanes(oPlane1, oPlane3)

 

Here is the full list of Add and Set methods available to create and redefine existing work features.

 

WorkAxis object

AddByAnalyticEdge

SetByAnalyticEdge

AddByLine

SetByLine

AddByLineAndPlane

SetByLineAndPlane

AddByLineAndPoint

SetByLineAndPoint

AddByNormalToSurface

SetByNormalToSurface

AddByRevolvedFace

SetByRevolvedFace

AddByTwoPlanes

SetByTwoPlanes

AddByTwoPoints

SetByTwoPoints

AddFixed

SetFixed

 

WorkPlane

AddByLineAndTangent

SetByLineAndTangent

AddByLinePlaneAndAngle

SetByLinePlaneAndAngle

AddByNormalToCurve

SetByNormalToCurve

AddByPlaneAndOffset

SetByPlaneAndOffset

AddByPlaneAndPoint

SetByPlaneAndPoint

AddByPlaneAndTangent

SetByPlaneAndTangent

AddByPointAndTangent

SetByPointAndTangent

AddByThreePoints

SetByThreePoints

AddByTorusMidPlane

SetByTorusMidPlane

AddByTwoLines

SetByTwoLines

AddByTwoPlanes

SetByTwoPlanes

AddFixed

SetFixed

 

Workpoint

AddAtCentroid

SetAtCentroid

AddByCurveAndEntity

SetByCurveAndEntity

AddByMidPoint

SetByMidPoint

AddByPoint

SetByPoint

AddBySphereCenterPoint

SetBySphereCenterPoint

AddByThreePlanes

SetByThreePlanes

AddByTorusCenterPoint

SetByTorusCenterPoint

AddByTwoLines

SetByTwoLines

AddFixed

SetFixed


Viewing all articles
Browse latest Browse all 518

Trending Articles