Macro to Toggle "Show Component Descriptions".
Macro to Toggle "Show Component Descriptions".
(OP)
Does anyone have a 2007 macro to toggle "Show Component Descriptions" from the Tree Display?
Thanks,
Sylvia
Thanks,
Sylvia
When was the last time you drove down the highway without seeing a commercial truck hauling goods?
Download nowINTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
Macro to Toggle "Show Component Descriptions".
|
RE: Macro to Toggle "Show Component Descriptions".
CODE
Dim aMod As SldWorks.ModelDoc2
Dim FM As SldWorks.FeatureManager
Dim CurSet As Boolean
Sub main()
On Error GoTo ExitStrategy
Set swApp = Application.SldWorks
Set aMod = swApp.ActiveDoc
Set FM = aMod.FeatureManager
CurSet = FM.ShowComponentDescriptions
If CurSet Then CurSet = False Else CurSet = True
FM.ShowComponentDescriptions = CurSet
ExitStrategy:
Set FM = Nothing
Set aMod = Nothing
Set swApp = Nothing
End Sub
http://www.EsoxRepublic.com-SolidWorks API VB programming help
RE: Macro to Toggle "Show Component Descriptions".
CODE
Application.SldWorks.ActiveDoc.FeatureManager.ShowComponentDescriptions = Not Application.SldWorks.ActiveDoc.FeatureManager.ShowComponentDescriptions
End Sub
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
Start a brand new macro, delete EVERYTHING, and paste in the code.
I tried handleman's code. Works for me.
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
My experience is that most SW API calls return 1 for true bool value wereas VBA returns -1 (cint(True)). What am I missing here?
Regards,
Regg
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
They are working for me in 2007
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
RE: Macro to Toggle "Show Component Descriptions".
After re-reading the pertinent section in the API help, it looks like they are saying that there's no way (other than by testing) to know whether any given call that returns a true or false value will return a 1 or -1 for "true". This is not quite what I had posted previously. The help suggests to always compare the returned value to "false". Sorry for any confusion or frustration my previously incorrect posts may have caused!
RE: Macro to Toggle "Show Component Descriptions".
What's this macro for? You can turn this on manually, no?
I must be missing something here...
Macduff![[spin] spin](https://www.tipmaster.com/images/spin.gif)
Colin Fitzpatrick
Mechanical Design Engineer
Solidworks 2007 SP 5.0
Dell 390 XP Pro SP 2
Intel 2 Duo Core, 2GB RAM
nVida Quadro FX 3450 512 MB
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".
If the function is only used once a week and saves 10 clicks, IMO its not worth assigning and remembering a key. (I have too little working grey matter left for such things). If it's used several times a day but saves only one click then it's probably worth allocating a few brain cells for.
RE: Macro to Toggle "Show Component Descriptions".
I'm with a new company where previous employees created numerous Toolbox items with catalog p/ns. We are in the process of assigning random, consecutive p/ns and obsoleting the originals. Many of our assemblies are unique, and can be revised during a slow time, so we are only replacing on an "as needed" basis. As we obsolete, we created a component description that shows what it was replaced with. This macro allows me to toggle the description on to replace and then off when completed. It also helps when searching through the tree for specific items, because we use random p/ns. It was just inconvenient the othe way, and we will use it multiple times a day. Sylvia
RE: Macro to Toggle "Show Component Descriptions".
Macduff![[spin] spin](https://www.tipmaster.com/images/spin.gif)
Colin Fitzpatrick
Mechanical Design Engineer
Solidworks 2007 SP 5.0
Dell 390 XP Pro SP 2
Intel 2 Duo Core, 2GB RAM
nVida Quadro FX 3450 512 MB
RE: Macro to Toggle "Show Component Descriptions".
I've never made much use of the Application keywork in VB. Can you expound? Got any links?
Can't use Google for this. Keywords "VB Application keyword" yields way to much junk.
RE: Macro to Toggle "Show Component Descriptions".
Matt Lorono
CAD Engineer/ECN Analyst
Silicon Valley, CA
Lorono's SolidWorks Resources
Co-moderator of Solidworks Yahoo! Group
and Mechnical.Engineering Yahoo! Group
RE: Macro to Toggle "Show Component Descriptions".
I'm not really sure. Maybe it's VBA-specific? Program-specific? I'm pretty much self-taught with all this stuff, so there are some pretty large gaps in my knowledge. I do know that the object returned is dependent on what program is running the VBA. For example, if you're using Excel VBA to drive SolidWorks, you can't use Application.SldWorks to get the SolidWorks object. That's pretty much the limit of my knowledge. In the code I posted, I'm not really using it any differently than you are. I just chained a bunch of objects together.
RE: Macro to Toggle "Show Component Descriptions".
RE: Macro to Toggle "Show Component Descriptions".