Move Face command generation with ILogic

Move Face command generation with ILogic

Thomas.Long
Advocate Advocate
672 Views
3 Replies
Message 1 of 4

Move Face command generation with ILogic

Thomas.Long
Advocate
Advocate

I'm having difficulty finding the correct syntax necessary to generate a move face command. I was wondering if anyone could point me in the right direction. Everything else in my code works up until the "oMoveFace =" line.I can't find the syntax for the movefacefeatures portion, nor am I sure that create movefacedefinition will be the correction notation. Any help at all would be appreciated.

 

Thank you,

Thomas Long 

 

'Declare Document Variables
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
	Dim oAsm As AssemblyDocument
	Dim oAsmCompDef As AssemblyComponentDefinition
	Dim oMoveFace As MoveFaceDefinition
	
	oMoveFace = oAsmCompDef.Features.MoveFaceFeatures.CreateMoveFaceDefinition(Face_End, kMoveFaceOperation)
	Call oMoveFace.SetDistanceExtent(Parameter("AngleEnd" & Instance) - Parameter("AngleStart" & Instance) - 120, kPositiveExtentDirection)
0 Likes
673 Views
3 Replies
Replies (3)
Message 2 of 4

JarFu
Autodesk
Autodesk

Hi Thomas,

 

With Inventor 2011 and newer version, you can use below iLogic code to create the Move Face feature in assembly or part file.

Before running the rule, please select one face and one edge/ axis (as the direction), else oDoc.SelectSet(1) and oDoc.SelectSet(2) lines will raise error.

 

Dim oDoc
oDoc = ThisApplication.ActiveDocument

Dim oMoveFaces
oMoveFaces = oDoc.ComponentDefinition.Features.MoveFaceFeatures

Dim oFaceCol
oFaceCol = ThisApplication.TransientObjects.CreateFaceCollection
oFaceCol.Add (oDoc.SelectSet(1))

Dim oMFDef
oMFDef = oMoveFaces.CreateDefinition(oFaceCol)
oMFDef.SetDirectionAndDistanceMoveType( 1, oDoc.SelectSet(2))

Dim oMF
oMF = oMoveFaces.Add(oMFDef)



Jar Fu
SW Engineer
Inventor QA
Autodesk, Inc.
0 Likes
Message 3 of 4

JarFu
Autodesk
Autodesk

Hi Thomas,

 

With Inventor 2011 and newer version, you can use below iLogic code to create the Move Face feature in assembly or part file.

Before running the rule, please select one face and one edge/ axis (as the direction), else oDoc.SelectSet(1) and oDoc.SelectSet(2) lines will raise error.

 

Dim oDoc
oDoc = ThisApplication.ActiveDocument

Dim oMoveFaces
oMoveFaces = oDoc.ComponentDefinition.Features.MoveFaceFeatures

Dim oFaceCol
oFaceCol = ThisApplication.TransientObjects.CreateFaceCollection
oFaceCol.Add (oDoc.SelectSet(1))

Dim oMFDef
oMFDef = oMoveFaces.CreateDefinition(oFaceCol)
oMFDef.SetDirectionAndDistanceMoveType( 1, oDoc.SelectSet(2))

Dim oMF
oMF = oMoveFaces.Add(oMFDef)



Jar Fu
SW Engineer
Inventor QA
Autodesk, Inc.
0 Likes
Message 4 of 4

Thomas.Long
Advocate
Advocate

Sorry for the late reply;

 

So I tried what you suggested and am getting an error.

 

Public member 'CreateDefintion' on type 'MoveFaceFeatures' not found.

 

The error occurs on the line 

SyntaxEditor Code Snippet

oMFDef = oMoveFaces.CreateDefintion(Face_End)

 

I'm currently on Inventor 2015, so I'm guessing it might be a syntax difference? Here is a summary of my full Ilogic code for this function.

 

'Creates constraints for picked faces off of the base planes for the file
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
Function AngleSetup(SideDConstraint, DConstraint, SideAConstraint, AConstraint, Depth, SurfaceConstraint, Instance, Axis)

	'On Error Resume Next

'Declare Document Variables
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
	Dim Constrain As AssemblyConstraints
	Dim Face_Top As Face
	Dim Face_Web As Face
	Dim Face_End As Face
	Dim oAsm As AssemblyDocument
	Dim oDoc
	Dim oMF
	Dim oMFDef 
	Dim oMoveFaces

	
	oAsm = ThisDoc.Document
	oDoc = ThisApplication.ActiveDocument
	constrain = oAsm.ComponentDefinition.Constraints
	oMyParameter= oAsm.ComponentDefinition.Parameters.UserParameters 
	oMoveFaces = oDoc.ComponentDefinition.Features.MoveFaceFeatures
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
		

'Pick faces for constraining
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
	Face_Top = ThisApplication.CommandManager.Pick (SelectionFilterEnum.kAllPlanarEntities, "Select Left Flange") 
	Face_Web = ThisApplication.CommandManager.Pick (SelectionFilterEnum.kAllPlanarEntities, "Select Right Flange")
	Face_End = ThisApplication.CommandManager.Pick (SelectionFilterEnum.kAllPlanarEntities, "Select end of angle")
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
		

'Constrain to XZ Plane
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
	If AConstraint = "Mate" Then Constrain.AddMateConstraint(Face_Web, SharedVariable("XZPlane"), SideAConstraint*2.54)
	If AConstraint = "Flush" Then Constrain.AddFlushConstraint(Face_Web, SharedVariable("XZPlane"), SideAConstraint*2.54)
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	


'Constrain to YZ Plane
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
	If DConstraint = "Mate" Then Constrain.AddMateConstraint(Face_End, SharedVariable("YZPlane"), SideDConstraint*2.54)
	If DConstraint = "Flush" Then Constrain.AddFlushConstraint(Face_End, SharedVariable("YZPlane"), SideDConstraint*2.54)
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
		

'Constrain to XY Plane (Front View)
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	
	If SurfaceConstraint = "Flush" Then Constrain.AddFlushConstraint(Face_Top, SharedVariable("XYPlane"), -Depth*2.54)
	If SurfaceConstraint = "Mate" Then Constrain.AddMateConstraint(Face_Top, SharedVariable("XYPlane"), -Depth*2.54)
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	

	Length = Abs(Parameter("AngleEnd" & Instance) - Parameter("AngleStart" & Instance)) - 120

	oMFDef = oMoveFaces.CreateDefintion(Face_End)
	oMFDef.SetDirectionAndDistanceMoveType(Length, Axis)
	
	oMF = oMoveFaces.Add(oMFDef)
End Function
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
0 Likes