API: How Store Temp Axis Selection?
API: How Store Temp Axis Selection?
(OP)
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
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)
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






RE: API: How Store Temp Axis Selection?
i.e.
CODE
Also, try stepping through the code one line at a time to see if all the objects are getting assigned properly. Use your "locals" window to inspect each object.
RE: API: How Store Temp Axis Selection?
CODE
It didn't work. I still get the same error "The object invoked has disconnected from it's clients".
I stepped thru the code and all the objects went from a variable value of "Nothing" to a value of "<No Variables>"...which I have always assumed to be the correct initializing of an object.
This macro works fine for faces, planes, and axes. It doesn't work for Temporary Axes and I am trying to figure out why.
Thanks anyway,
Ken
RE: API: How Store Temp Axis Selection?
>>
It looks like I have open SPR 117754 - When QI a temporary Axis for the entity interface, you get a valid entity pointer how ever when you call select .. nothing..
<<
RE: API: How Store Temp Axis Selection?