Search found 47 matches

by loeb
Mon May 06, 2024 4:01 pm
Forum: API
Topic: Need to determine the value of DIM with attached GTOL
Replies: 1
Views: 229

Need to determine the value of DIM with attached GTOL

Given a selected GTOL frame, I need to determine the value of the DIM that the GTOL is attached to. It's easy enough to get the properties of a GTOL frame, and I can determine if it's attached to something, but getting the dimension itself is eluding me.

Thanks,
by loeb
Fri Nov 24, 2023 4:06 pm
Forum: Macro Library
Topic: Reset Light Sources
Replies: 3
Views: 725

Re: Reset Light Sources

I wrote a similar one that deletes all lights and sets ambient to 1. Now all our parts that are the same material look the same.
by loeb
Thu Sep 28, 2023 9:38 am
Forum: API
Topic: Unable to Select and Unsuppress Center of Mass Feature
Replies: 10
Views: 1045

Re: Unable to Select and Unsuppress Center of Mass Feature

gupta9665 wrote: Thu Sep 28, 2023 6:56 am Yes because recorder was spiting "CenterOfMass" as "CENTEROFMASS".
I don't use the macro recorder. When I use print.debug to print the type, it was in mixed case..
by loeb
Wed Sep 27, 2023 12:06 pm
Forum: API
Topic: Unable to Select and Unsuppress Center of Mass Feature
Replies: 10
Views: 1045

Re: Unable to Select and Unsuppress Center of Mass Feature

Don't use SelectByID2. SelectByID is what the macro recorder uses, but it's almost always the wrong thing to use when you're actually writing a macro. In this case, you already have a pointer to the Feature object, which has a Select2 method. But, in fact, since you already have a pointer to the Fe...
by loeb
Wed Sep 27, 2023 11:58 am
Forum: API
Topic: Unable to Select and Unsuppress Center of Mass Feature
Replies: 10
Views: 1045

Re: Unable to Select and Unsuppress Center of Mass Feature

gupta9665 wrote: Wed Sep 27, 2023 9:34 amTry this
UCASE? That's nuts when swFeat.GetTypeName literally returns "CenterOfMass"

Thanks
by loeb
Wed Sep 27, 2023 8:52 am
Forum: API
Topic: Unable to Select and Unsuppress Center of Mass Feature
Replies: 10
Views: 1045

Unable to Select and Unsuppress Center of Mass Feature

When I insert a Center of Mass feature, it ends up being suppressed in all the unactive configurations even though I have the "Suppress Feature" setting unchecked in the properties for every configuration. So, I wrote a macro that will iterate through every configuration and every feature,...
by loeb
Wed Aug 23, 2023 11:39 am
Forum: API
Topic: Can't Delete Sheet Format AutoZones/Borders
Replies: 0
Views: 622

Can't Delete Sheet Format AutoZones/Borders

My engineering group is having a problem where the SW Drawing AutoZones/Borders are being created 'by themselves' and often go undetected until later in our work flow, creating additional work to correct them. I want to modify one of our commonly used macros to also automatically delete these if the...
by loeb
Mon Aug 21, 2023 2:07 pm
Forum: API
Topic: Can't change Document Property
Replies: 3
Views: 452

Re: Can't change Document Property

Thank You, AlexB. I would have never caught that "typo" since I copied it verbatim from the SW API help pages. I can't figure out is what the proper syntax is for calls like this. I originally used the "BoolStatus = swApp.SetUserPreference..." form because that's what SW has in e...
by loeb
Mon Aug 21, 2023 12:57 pm
Forum: API
Topic: Can't change Document Property
Replies: 3
Views: 452

Can't change Document Property

Under Options->Document Properties->Drawing Sheets->Sheet format for new sheets, I am trying to change the settings using the methods documented here: https://help.solidworks.com/2021/english/api/swconst/DP_DrawingSheets.htm I have done this for other settings successfully, but just can't get it to ...
by loeb
Fri Aug 18, 2023 8:00 pm
Forum: How To Questions
Topic: How can I find if Mass Properties have been Overridden
Replies: 2
Views: 672

How can I find if Mass Properties have been Overridden

I have some assemblies and discovered that someone, a long time ago, overrode the mass properties of some of the parts. Other than going through every part and checking if the mass props have been overridden in every configuration, is there an easy way to identify them?
by loeb
Fri Aug 18, 2023 12:39 pm
Forum: API
Topic: Determine Configuration Name for each BOM QTY Column?
Replies: 1
Views: 386

Determine Configuration Name for each BOM QTY Column?

I have a BOM table for multiple configurations of an assembly. I would like to be able to get the name of the configuration for each QTY column. Is there a way to traverse the QTY columns and get the config name/number?
by loeb
Fri Aug 04, 2023 9:33 am
Forum: 2D Drawings
Topic: Row height on revision table
Replies: 9
Views: 2545

Re: Row height on revision table

This is likely linked to the fact that the Document Setting for Table Vertical Cell Padding is ignored by SolidWorks Drawings and has been for well over a decade. I just reported this bug (again).
by loeb
Wed Jul 19, 2023 9:33 pm
Forum: API
Topic: Macro in the PDM Vault
Replies: 17
Views: 1530

Re: Macro in the PDM Vault

What are you guys talking about an "add-in" instead of a macro?
by loeb
Thu Apr 06, 2023 2:35 pm
Forum: API
Topic: Material Search Add-In
Replies: 22
Views: 3111

Re: Material Search Add-In

JSculley wrote: Thu Apr 06, 2023 7:50 am The DLL and instructions on how to register it are now here:

https://github.com/jsculley/MaterialSea ... es/tag/0.4
Thank You!
by loeb
Wed Mar 29, 2023 11:51 pm
Forum: API
Topic: Material Search Add-In
Replies: 22
Views: 3111

Re: Material Search Add-In

JSculley wrote: Tue Mar 28, 2023 10:07 am Can you read/write to the registry via the Registry Editor? If so, I can provide instructions on how to manually 'install' the add-in.
Yes, I can do that (so far). That would be great! Thank you.
by loeb
Tue Mar 28, 2023 8:58 am
Forum: API
Topic: Material Search Add-In
Replies: 22
Views: 3111

Re: Material Search Add-In

Because of my company's security policy, installing an MSI is difficult/impossible for apps that are not trusted. Is a standalone version possible?
by loeb
Sun Mar 26, 2023 12:16 pm
Forum: API
Topic: Solutions to Drawing Table Cell Padding Bug?
Replies: 0
Views: 776

Solutions to Drawing Table Cell Padding Bug?

When creating new tables, cell padding often ends up being set to something different from what's specified in document properties. Often one or both of the padding values will be 0 (zero) instead of the non-zero value I specify (such as 0.02 in). I have tried writing VBA code to programatically se ...
by loeb
Mon Sep 12, 2022 10:45 am
Forum: API
Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
Replies: 6
Views: 556

Re: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties

Josh,

This helps. There is only one Ambient light and this function only works on Ambient lights. Specifying the light name did do the trick, though.
by loeb
Sun Sep 11, 2022 11:56 am
Forum: API
Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
Replies: 6
Views: 556

Re: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties

Here's a sample of code: Option Explicit Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim ModelDocExtension As ModelDocExtension Dim BoolStatus As Boolean Dim i As Integer Dim LightSourceCount As Integer Dim LightSourcename As String Dim LightSourceUserName As String D...
by loeb
Sat Sep 10, 2022 10:53 pm
Forum: API
Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
Replies: 6
Views: 556

Re: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties

What are you expecting to get from the function? It returns true or false. Do you understand what ByRef means? You have to pass variables into the function to receive all the values. That's how I'm using it and when I inspect the values after calling GetAmbienLight Properties, they are all zero or ...
by loeb
Sat Sep 10, 2022 7:58 pm
Forum: API
Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
Replies: 6
Views: 556

Re: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties

josh wrote: Sat Sep 10, 2022 7:00 pm What are you expecting to get from the function? It returns true or false. Do you understand what ByRef means? You have to pass variables into the function to receive all the values.
It must be the byref thingy. Guess I'll have to figure that out. Never rant into that that before.
by loeb
Sat Sep 10, 2022 6:42 pm
Forum: API
Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
Replies: 6
Views: 556

Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties

Does anyone have any VBA examples that use GetAmbientLightProperties or SetAmbientLightProperties. I can't get anything but 0 or FALSE values from GettAmbientLightProperties. I also had to initialize/dim "Colour" to Long (instead of Integer as the API help defines it) to get it to complile...
by loeb
Fri Jun 03, 2022 8:07 am
Forum: API
Topic: How to make an duplicate array of the Selection Manager?
Replies: 3
Views: 527

Re: How to make an duplicate array of the Selection Manager?

Typically, you'll either want to do one of two things. 1. Keep all of the types of objects in an array the same type 2. Use 2 separate arrays of the same length and have array1 hold the objects and have array2 hold the object types. This way, if you know what type to treat your object as from array...
by loeb
Thu Jun 02, 2022 7:11 am
Forum: API
Topic: How to make an duplicate array of the Selection Manager?
Replies: 3
Views: 527

How to make an duplicate array of the Selection Manager?

I need to make an array of everything that the user has selected in the feature tree of an assembly file. The selected items an be planes, sketches, mates, parts, assemblies, etc. I made a copy of the selection manager's array in the form of a variant array, but I can't figure out how to operate on ...
by loeb
Wed May 18, 2022 8:29 pm
Forum: API
Topic: How does one use swCenterMarkConnectionLine_e Enumeration?
Replies: 1
Views: 745

How does one use swCenterMarkConnectionLine_e Enumeration?

I am working on some macros that gets and sets document properties for CenterMarks and gets and sets properties of CenterMarks themselves. I am trying to manipulate the settings around Circular Lines, Radial Lines, and Base Center Mark. I found the enumeration regarding this setting here: https://he...
by loeb
Mon May 09, 2022 11:52 pm
Forum: API
Topic: Custom design check - layers
Replies: 7
Views: 1480

Re: Custom design check - layers

Zhen-Wei Tee, That idea will work well for use because we use a unique revision table symbol (circle square) which is a headache since that's not a valid default symbol, so we have to manually change the symbol from one of the default options, but in this case, it will work in our favor since that s...
by loeb
Sat May 07, 2022 8:21 pm
Forum: API
Topic: How to identify the "parent" of a Centermark?
Replies: 1
Views: 354

How to identify the "parent" of a Centermark?

Is there a way, using VBA, to identify the geometry (arc, circle, hole, etc) that a CenterMark is attached to? If that's possible, I'd then want to be able to get properties of that geometry, such as diameter/radius.

Thank you
by loeb
Sat May 07, 2022 7:48 pm
Forum: API
Topic: Custom design check - layers
Replies: 7
Views: 1480

Re: Custom design check - layers

Hammer, I recently ran into a limitation that I think will be a problem for you too. I don't think that there's a way to identify if a note is a revision symbol. I wanted to make a macro that finds and changes the color of all revision symbols that might be left over from previous revisions, but cou...
by loeb
Sat May 07, 2022 7:36 pm
Forum: API
Topic: select bom row
Replies: 2
Views: 515

Re: select bom row

You could add a column to the BOM table and put in an "X" for every item that is missing a balloon. The user could use this to mark their progress as they correct the missing balloons. Then, it would be simple for them to delete the column when they are done.
by loeb
Wed Mar 23, 2022 8:30 pm
Forum: API
Topic: I need help writing a keyboard event handler in VBA.
Replies: 4
Views: 1280

Re: I need help writing a keyboard event handler in VBA.

gupta9665 wrote: Mon Mar 21, 2022 2:23 am Sorry, I went the other way round. Check the macro codes here https://wellsr.com/vba/2017/excel/GetAs ... s-pressed/
Nice! I'll check that out.
by loeb
Sun Mar 20, 2022 3:23 pm
Forum: API
Topic: Property Tab Builder apply to both Global and Default config
Replies: 6
Views: 1208

Re: Property Tab Builder apply to both Global and Default config

If I'm not mistaken, Solidworks always checks first to see if a configuration property exists. If it does exists, then it would ignore the values in the Global and only use the Configuration property value. If it doesnt exist, then it would take the value from the Global. ResidentAtLarge, you are c...
by loeb
Sun Mar 20, 2022 3:10 pm
Forum: API
Topic: I need help writing a keyboard event handler in VBA.
Replies: 4
Views: 1280

Re: I need help writing a keyboard event handler in VBA.

SendKeys should be the key you looking for. Check codes by @Josh here https://r1132100503382-eu1-3dswym.3dexperience.3ds.com/#community:yUw32GbYTEqKdgY7-jbZPg/iquestion:cPZa4KkjSHKVJEaLiC692g Deepak, Thank you for your response. The Microsoft VBA reference says that SendKeys "Sends one or more...
by loeb
Sat Mar 19, 2022 3:30 pm
Forum: API
Topic: I need help writing a keyboard event handler in VBA.
Replies: 4
Views: 1280

I need help writing a keyboard event handler in VBA.

I need help writing a keyboard event handler in VBA. I'm trying to write a macro that will interact with the mouse and keyboard. I found a GREAT forum post where Josh Brady posted some code that works great with the mouse using GetMouse. In this example, if the mouse is clicked, a dialog comes up wi...
by loeb
Sat Mar 12, 2022 8:24 pm
Forum: API
Topic: Change Revision Symbol Border?
Replies: 1
Views: 409

Re: Change Revision Symbol Border?

I figured that that a Revision Symbol is really just a Balloon. I can insert the Revision Symbol using

Code: Select all

swModel.InsertRevisionSymbol()
then change its format and border using

Code: Select all

SetTextFormat()
by loeb
Sat Mar 12, 2022 4:44 pm
Forum: API
Topic: Change Revision Symbol Border?
Replies: 1
Views: 409

Change Revision Symbol Border?

After inserting a Revision Symbol

Code: Select all

value = instance.InsertRevisionSymbol(X, Y)
How can I change its border. I don't see any method for that.

Thank You
by loeb
Sat Mar 12, 2022 3:47 pm
Forum: API
Topic: Where do you get your MACRO ICONS
Replies: 7
Views: 3932

Re: Where do you get your MACRO ICONS

I did find this tip at https://www.javelin-tech.com/blog/2020/10/creating-macro-buttons-in-solidworks/ Extra: As you can see above, the Macro button has a generic icon image. If you want to apply a unique image for the Macro button, click “Choose Image” under “Appearance” in Step7. SOLIDWORKS provid...
by loeb
Sat Mar 12, 2022 11:24 am
Forum: API
Topic: Where do you get your MACRO ICONS
Replies: 7
Views: 3932

Where do you get your MACRO ICONS

I've developed a bunch of VBA macros that I depend on regularly. I have them in a custom toolbar, but they all have the same default SolidWorks icon. 1) Have you found a 'library' of useful icons that work well for this purpose? 2) Do you have a utility that makes it quick and easy to make your own ...
by loeb
Fri Mar 11, 2022 9:33 am
Forum: API
Topic: Need help iterating through Configurations... sort of
Replies: 4
Views: 735

Re: Need help iterating through Configurations... sort of

gupta9665 wrote: Fri Mar 11, 2022 2:40 am Both codes works fine for me i.e. hiding al the planes.
Deepak, it works on the active config, but none of the others. Using ShowConfiguration2 solved the issue.
by loeb
Fri Mar 11, 2022 9:31 am
Forum: API
Topic: Need help iterating through Configurations... sort of
Replies: 4
Views: 735

Re: Need help iterating through Configurations... sort of

The only thing that I have in my similar macro is that I am calling to show the configuration before I begin trying to hide the geometry. In your code, this can be the first line in your For Each loop. swModel.ShowConfiguration2 vConfigName Another thing to note, to speed things up you can check to...
by loeb
Thu Mar 10, 2022 10:20 pm
Forum: API
Topic: Need help iterating through Configurations... sort of
Replies: 4
Views: 735

Need help iterating through Configurations... sort of

I'm trying to get a macro that hides all primary planes to work on all configurations. It works on the current configuration. It even iterates through all the other configurations and successfully prints their names. But the command that turns off the primary planes is only working on the 'first' co...
by loeb
Sun Mar 06, 2022 1:47 pm
Forum: API
Topic: Bug? Units VBA macro turns on Scene Reflections and Shadows
Replies: 4
Views: 940

Re: Bug? Units VBA macro turns on Scene Reflections and Shadows

What are the settings for scene shadows and scene reflection in your *.p2s scene file? ... I'm curious if anyone else has similar, or different experiences. Ryan, I didn't think about looking there because I really don't mess with scenes unless I'm trying to render and that very infrequent for me. ...
by loeb
Sun Feb 13, 2022 6:04 pm
Forum: Macro Library
Topic: Need Macro to change length units
Replies: 13
Views: 9959

Re: Need Macro to change length units

gupta9665 wrote: Sun Feb 13, 2022 6:10 am No changes on my end. Can you please share a video showing the concern.
Try this swp with the part I attached earlier. Here it is:
by loeb
Sun Feb 13, 2022 3:34 am
Forum: Macro Library
Topic: Need Macro to change length units
Replies: 13
Views: 9959

Re: Need Macro to change length units

gupta9665 wrote: Sun Feb 13, 2022 2:34 am Could you attach your file to check.
Sure. Here's the part file I'm testing with:
by loeb
Sat Feb 12, 2022 5:57 pm
Forum: How To Questions
Topic: General table with Config info?
Replies: 9
Views: 966

Re: General table with Config info?

It BLOWS MY MIND that this functionality does not exist. We wrote some macros that cycle through the configs and put Custom Properties in a table. The data is not parametrically linked to the parts/assemblies, but you can always delete the general table and rerun the macro when you need an update.
by loeb
Sat Feb 12, 2022 5:43 pm
Forum: API
Topic: Bug? Units VBA macro turns on Scene Reflections and Shadows
Replies: 4
Views: 940

Bug? Units VBA macro turns on Scene Reflections and Shadows

I have a macro that sets the document Units the way I like them, but it has the strange side effect of turning on the Scene Shadows and Reflections in all the inactive configurations. Does anyone have any idea why this might be or is it a bug? Option Explicit Sub main() Dim swApp As SldWorks.SldWork...
by loeb
Sat Feb 12, 2022 5:37 pm
Forum: Macro Library
Topic: Need Macro to change length units
Replies: 13
Views: 9959

Re: Need Macro to change length units

I have the following code that works on one file. It works, but has the strange effect of turning on Scene Shadows and Reflections for inactive configurations. Here's the code Option Explicit Sub main() Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim BoolStatus As Boolean Dim Sy...
by loeb
Sat Feb 12, 2022 4:45 pm
Forum: API
Topic: Revision Table Anchor point
Replies: 2
Views: 730

Re: Revision Table Anchor point

I can confirm this bug. I asked one of the SolidWorks developers why the SPR is inactive if the bug hasn't been fixed. I was told that people stopped reporting the bug, so they made the SPR inactive. :(