SBaugh
Mechanical
- Mar 6, 2001
- 6,686
I tried to record a macro, then followed the process that I want the macro to do which is to change the tree display.
Turn on "Show Component Description"
Turn off "Show Component Confugration Names"
Turn off "Show Display State Names"
I need it to run for any assembly.
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim COSMOSWORKSObj As Object
Dim CWAddinCallBackObj As Object
Set CWAddinCallBackObj = swApp.GetAddInObject("CosmosWorks.CosmosWorks")
Set COSMOSWORKSObj = CWAddinCallBackObj.COSMOSWORKS
boolstatus = Part.Extension.SelectByID2("", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
StudyManagerObj = Nothing
ActiveDocObj = Nothing
Set CWAddinCallBackObj = Nothing
Set COSMOSWORKSObj = Nothing
End Sub
If fails on the
Set COSMOSWORKSObj = CWAddinCallBackObj.COSMOSWORKS
StudyManagerObj = Nothing
ActiveDocObj = Nothing
Then nothing happens... I have no clue about how macros are supposed to work if it doesn't record what I actually did and what I want it to repeat.
Any help would be appreciated
Scott Baugh, CSWP![[pc2] [pc2] [pc2]](/data/assets/smilies/pc2.gif)
CAD Systems Manager
Dapco, INC
Turn on "Show Component Description"
Turn off "Show Component Confugration Names"
Turn off "Show Display State Names"
I need it to run for any assembly.
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Dim COSMOSWORKSObj As Object
Dim CWAddinCallBackObj As Object
Set CWAddinCallBackObj = swApp.GetAddInObject("CosmosWorks.CosmosWorks")
Set COSMOSWORKSObj = CWAddinCallBackObj.COSMOSWORKS
boolstatus = Part.Extension.SelectByID2("", "COMPONENT", 0, 0, 0, False, 0, Nothing, 0)
Part.ClearSelection2 True
StudyManagerObj = Nothing
ActiveDocObj = Nothing
Set CWAddinCallBackObj = Nothing
Set COSMOSWORKSObj = Nothing
End Sub
If fails on the
Set COSMOSWORKSObj = CWAddinCallBackObj.COSMOSWORKS
StudyManagerObj = Nothing
ActiveDocObj = Nothing
Then nothing happens... I have no clue about how macros are supposed to work if it doesn't record what I actually did and what I want it to repeat.
Any help would be appreciated
Scott Baugh, CSWP
![[pc2] [pc2] [pc2]](/data/assets/smilies/pc2.gif)
CAD Systems Manager
Dapco, INC
faq731-376"If it's not broke, Don't fix it!"