brengine
Mechanical
- Apr 19, 2001
- 616
If I preselect a face, plane, or axis, and then run the following macro...the program will store the selected entity, clear all selections, and then reselect that entity.
If I preselect a temporary axis I get an error on the last (re-select) line. I just turned on the macro recorder and selected a reference axis and then selected a temporary axis and got this (I trimmed the number entries down to 3 decimals):
The problem seems to the that the ID name of the temporary axis is missing the first portion of the name. Does anyone know if this is a bug or of a way to get around this? Running SW2004 sp4.0.
Thanks,
Ken
Code:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim MySWAssembly As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSelData As SldWorks.SelectData
Dim MyEntity As SldWorks.entity
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set MySWAssembly = swApp.ActiveDoc
Set swSelMgr = MySWAssembly.SelectionManager
Set swSelData = swSelMgr.CreateSelectData
Set MyEntity = swSelMgr.GetSelectedObject5(1)
MySWAssembly.ClearSelection2 True
boolstatus = MyEntity.Select4(True, swSelData)
End Sub
If I preselect a temporary axis I get an error on the last (re-select) line. I just turned on the macro recorder and selected a reference axis and then selected a temporary axis and got this (I trimmed the number entries down to 3 decimals):
Code:
boolstatus = Part.Extension.SelectByID("Axis1", "AXIS", -0.0479, 0.053, 0.003, False, 0, Nothing)
boolstatus = Part.Extension.SelectByID("@BasePart-1@InsertHardware", "AXIS", -0.046, 0.025, 0.030, False, 0, Nothing)
The problem seems to the that the ID name of the temporary axis is missing the first portion of the name. Does anyone know if this is a bug or of a way to get around this? Running SW2004 sp4.0.
Thanks,
Ken