ILOGIC / VBA: rename default plans

ILOGIC / VBA: rename default plans

amarcoc
Advocate Advocate
462 Views
3 Replies
Message 1 of 4

ILOGIC / VBA: rename default plans

amarcoc
Advocate
Advocate

Hi.

 

I want to rename the default plans with a ilogic or macro function (in both assembly and part files)

 

I searched and tried, but couldnt do it.

 

Any ideas?

 

Thanks

0 Likes
Accepted solutions (1)
463 Views
3 Replies
Replies (3)
Message 2 of 4

amarcoc
Advocate
Advocate
Accepted solution

Answered myself:

 

For Each oWorkPlane In ThisDoc.Document.ComponentDefinition.WorkPlanes
	Select Case oWorkPlane.Name 
		Case "YZ Plane - RIGHT", "XZ Plane - TOP", "XY Plane - FRONT"
			oWorkPlane.Visible = False
		Case "YZ Plane"
			oWorkPlane.Name = "YZ Plane - RIGHT"
		Case "XZ Plane"
			oWorkPlane.Name = "XZ Plane - TOP"
		Case "XY Plane"
			oWorkPlane.Name = "XY Plane - FRONT"
		Case Else
			'MessageBox.Show("Planos não encontrados", "Planos")
	End Select
Next

 

It renames and hides specific plans.

 

Thanks!

Message 3 of 4

Jef_E
Collaborator
Collaborator

I believe this code would be better without the last else statement, this will result in many message boxed is there are more planes than just the default plane.

 

For Each oWorkPlane In ThisDoc.Document.ComponentDefinition.WorkPlanes
	Select Case oWorkPlane.Name 
		Case "YZ Plane - RIGHT", "XZ Plane - TOP", "XY Plane - FRONT"
			oWorkPlane.Visible = False
		Case "YZ Plane"
			oWorkPlane.Name = "YZ Plane - RIGHT"
		Case "XZ Plane"
			oWorkPlane.Name = "XZ Plane - TOP"
		Case "XY Plane"
			oWorkPlane.Name = "XY Plane - FRONT"
	End Select
Next


Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 4 of 4

amarcoc
Advocate
Advocate

Thank you.

 

That message was only for debugging.

 

In fact, in latest version I removed it.

 

Thanks

0 Likes