Direct Edit Part / Face with iLogic

Direct Edit Part / Face with iLogic

C_Haines_ENG
Collaborator Collaborator
1,210 Views
8 Replies
Message 1 of 9

Direct Edit Part / Face with iLogic

C_Haines_ENG
Collaborator
Collaborator

Hello all,

 

Is it possible to direct edit solid bodies through iLogic API? I've seen very few posts about it and Inventor doesn't seem to show anything for it so I'd like to know if this is possible.

 

I would select a face, and it would direct edit it -4mm.

 

Thanks!

0 Likes
Accepted solutions (2)
1,211 Views
8 Replies
Replies (8)
Message 2 of 9

J_Pfeifer_
Advocate
Advocate
0 Likes
Message 3 of 9

C_Haines_ENG
Collaborator
Collaborator

Guess my google-fu was off today. Thanks!

0 Likes
Message 4 of 9

C_Haines_ENG
Collaborator
Collaborator

Actually these only get already placed direct edits dont they? I want to CREATE a direct edit.

0 Likes
Message 5 of 9

J_Pfeifer_
Advocate
Advocate

I was just linking to the references on the documentation. Figured it would be somewhere in one of these items. From my understanding it would have had a .Create Definition portion. 

 

Looking at the objects again you cannot use these to create anything due to their read only nature. Due to faces and features not exposing a direct edit method I have no idea how you would create the direct edit to start. Seems you can only use the direct edit objects to gain information from the model. Not modify it, or create it. 

 

Someone else might know but other than these items, I see no way to interface with a direct edit in the documentation. 

0 Likes
Message 6 of 9

C_Haines_ENG
Collaborator
Collaborator
Accepted solution

I was able to figure it out, the Inventor API website absolutely sucks.

 

Dim oAsm As AssemblyDocument = ThisDoc.Document

Dim oFaceProxy As FaceProxy = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Pick a feature")
Dim oFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection

Dim oDoc As PartDocument = ThisApplication.Documents.Open(oFaceProxy.Parent.Parent.ReferencedDocumentDescriptor.FullDocumentName, False)

oFaces.Add(oFaceProxy.NativeObject)

Dim oDocFeat As PartFeatures = oDoc.ComponentDefinition.Features 

Dim oMoveDef As MoveFaceDefinition = oDocFeat.MoveFaceFeatures.CreateDefinition(oFaces)
oMoveDef.SetDirectionAndDistanceMoveType("4 mm" , oFaces.Item(1), True)

Dim oMoveFeat As MoveFaceFeature = oDocFeat.MoveFaceFeatures.Add(oMoveDef)

oDoc.Save : oDoc.Close
0 Likes
Message 7 of 9

J_Pfeifer_
Advocate
Advocate

Is this actually creating an object within the Direct edit collection? 

 

It seems that we can access the count of the items within that direct edit. My concern or thought is that the move face feature is not actually a direct edit? Just seems like we would get to these features through the collection of direct edits, not the edits themselves to have multiple definitions.  Either way glad it worked for you. 

 

I second your opinion of the documentation entirely. Half of us come here to the forums for things that should be a single page. 

0 Likes
Message 8 of 9

C_Haines_ENG
Collaborator
Collaborator

In my attempts to get this working, it doesn't actually look like direct edit is a command you can put into a script. I believe its actually just an assortment of other tools such as MoveFaceFeatures and MoveFeatures, and direct edit is just a collection of those operations. 

 

Therefore the DirectEdit documentation can only be used to access items created by the user. Absolutely terrible! 🙂

 

Also now I have to figure out how to find if the face I'm clicking has already had a face moved. I'm sure going to enjoy that as well. 

0 Likes
Message 9 of 9

C_Haines_ENG
Collaborator
Collaborator
Accepted solution
Dim oAsm As AssemblyDocument = ThisDoc.Document

Dim oFaceProxy As FaceProxy = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Pick a feature")
Dim oFaces As FaceCollection = ThisApplication.TransientObjects.CreateFaceCollection

Try 
	Dim oCheckMoved As MoveFaceFeature = oFaceProxy.NativeObject.CreatedByFeature
	MsgBox("FACE IS ALREADY MOVED")
	Exit Sub
Catch
	oFaces.Add(oFaceProxy.NativeObject)
End Try

Dim oDoc As PartDocument = ThisApplication.Documents.Open(oFaceProxy.Parent.Parent.ReferencedDocumentDescriptor.FullDocumentName, False)

Dim oDocFeat As PartFeatures = oDoc.ComponentDefinition.Features 

Dim oMoveDef As MoveFaceDefinition = oDocFeat.MoveFaceFeatures.CreateDefinition(oFaces)
oMoveDef.SetDirectionAndDistanceMoveType("4 mm" , oFaces.Item(1), True)

Dim oMoveFeat As MoveFaceFeature = oDocFeat.MoveFaceFeatures.Add(oMoveDef)

oDoc.Save : oDoc.Close
0 Likes