AnsweredAssumed Answered

What is the correct way to rename a plane that was just created in a macro

Question asked by Jason Martin on Feb 1, 2019
Latest reply on Feb 1, 2019 by Attilio Colangelo

What is the best way to rename each plane that was created from running this macro. It just creates a newly numbered plane1, plane2, plane 3 when the macro is run.

I've tried using:

boolstatus = Part.SelectedFeatureProperties(0, 0, 0, 0, 0, 0, 0, 1, 0, "This is the new plane name")

between each newly created plane, but that doesnt work. Could I get some help with this?

Thanks in advance!

 

Here is my code:

 

Dim swApp As Object

 

 

Dim Part As Object

Dim boolstatus As Boolean

Dim longstatus As Long, longwarnings As Long

 

 

Sub main()

' ******************************************

' * The distance needs to be set in meters *

' ******************************************

Set swApp = Application.SldWorks

 

 

Set Part = swApp.ActiveDoc

Dim myRefPlane As Object

boolstatus = Part.Extension.SelectByID2("FRONT", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.127, 0, 0, 0, 0)

 

 

boolstatus = Part.Extension.SelectByID2("TOP", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.1524, 0, 0, 0, 0)

 

 

boolstatus = Part.Extension.SelectByID2("RIGHT", "PLANE", 0, 0, 0, True, 0, Nothing, 0)

Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.1778, 0, 0, 0, 0)

 

 

End Sub

Outcomes