Rename Origin Planes with iLogic

Rename Origin Planes with iLogic

ToniDunlop4246
Participant Participant
1,062 Views
5 Replies
Message 1 of 6

Rename Origin Planes with iLogic

ToniDunlop4246
Participant
Participant

Self explanatory, I want to rename the origin planes:

YZ Plane -> YZ Plane (RIGHT)

XZ Plane -> XZ Plane (TOP)

XY Plane -> XY Plane (RIGHT)

I come from SolidWorks and I find these names easier to read. I have already updated the templates for our parts, assy's and weldments but I need to update all of our existing files. Any help appreciated 😉

0 Likes
Accepted solutions (1)
1,063 Views
5 Replies
Replies (5)
Message 2 of 6

Sergio.D.Suárez
Mentor
Mentor

Hello, try this rule to perform this action,

Dim oPlaneYZ As WorkPlane = ThisDoc.Document.ComponentDefinition.WorkPlanes.Item(1) 
oPlaneYZ.Name = "YZ Plane (Right)"
Dim oPlaneXZ As WorkPlane = ThisDoc.Document.ComponentDefinition.WorkPlanes.Item(2) 
oPlaneXZ.Name = "XZ Plane (TOP)"
Dim oPlaneXY As WorkPlane = ThisDoc.Document.ComponentDefinition.WorkPlanes.Item(3) 
oPlaneXY.Name ="XY Plane (Right)"

 I hope you can solve your problem, greetings. 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 6

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

With this rule you can choose between parts and assemblies, by default open the directory of the document you have open, and rename all the files you select, because you have activated the multiple selection

Dim oFileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.Filter = "Inventor Files (*.iam;*.ipt)|*.iam;*.ipt"
oFileDlg.DialogTitle = "Change Part or Assembly"
oFileDlg.InitialDirectory = ThisDoc.Path
oFileDlg.MultiSelectEnabled =True 
oFileDlg.FilterIndex = 1
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowOpen()
If Err.Number <> 0 Then
	MessageBox.Show("File not chosen.", "Dialog Cancellation")
ElseIf oFileDlg.FileName <> "" Then
		
	Dim Separators() As Char = {"|"} 
	Sentence = oFileDlg.FileName
	Words = Sentence.Split(Separators)
	
	For Each wrd In Words
	Dim odoc As Document
	odoc = ThisApplication.Documents.Open(wrd, False)
	On Error Resume Next
		Dim oPlaneYZ As WorkPlane = odoc.ComponentDefinition.WorkPlanes.Item(1) 
		oPlaneYZ.Name = "YZ Plane (Right)"
		Dim oPlaneXZ As WorkPlane = odoc.ComponentDefinition.WorkPlanes.Item(2) 
		oPlaneXZ.Name = "XZ Plane (TOP)"
		Dim oPlaneXY As WorkPlane = odoc.ComponentDefinition.WorkPlanes.Item(3) 
		oPlaneXY.Name ="XY Plane (Right)"

	odoc.Save
	odoc.Close
	
	Next

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 4 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@ToniDunlop4246,

 

For this, create a new part and rename origin planes and save the part as template at default document path of Inventor 2019(C:\Users\Public\Documents\Autodesk\Inventor 2019\Templates) as shown in below image. Sample template is also attached with this post.

 

Template_Save.png

 

After creating template, you can use same template for creating new part as shown in below.

 

Create_New.png

 

For detail explanation, refer below knowledge article link.

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2016...

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 5 of 6

ToniDunlop4246
Participant
Participant

Thanks Chandra, I already had my templates set up like this, now I need to update all of the existing parts and assemblies that were created on the old template.

0 Likes
Message 6 of 6

ToniDunlop4246
Participant
Participant

Thanks Sergio, that did the trick. I am just using the code snippet to do the current open document for now, but will look at the rest of your code in order to do multiple files which would be ideal.

0 Likes