Search found 81 matches
- Wed Feb 12, 2025 5:37 pm
- Forum: API
- Topic: Can you create Subfolders in the Feature Tree?
- Replies: 4
- Views: 528
Re: Can you create Subfolders in the Feature Tree?
Hi Loeb, You could use ReorderFeature ' to place a new 'sub' folder within a folder. As shown in the code below. Stefan, Thanks, that's exactly what I'm looking for. I had already found ReorderComponent, but didn't realize that ReorderFeature was an available method. Since a folder is actually more...
- Wed Feb 12, 2025 3:35 pm
- Forum: API
- Topic: Can you create Subfolders in the Feature Tree?
- Replies: 4
- Views: 528
Re: Can you create Subfolders in the Feature Tree?
Thank you, Deepak!
- Wed Feb 12, 2025 7:19 am
- Forum: API
- Topic: Can you create Subfolders in the Feature Tree?
- Replies: 4
- Views: 528
Can you create Subfolders in the Feature Tree?
I am trying to create folders and subfolders in the feature tree. I have found that with the InsertFeatureTreeFolder2 method, you can create empty folders or folders that contain existing features, but the API help doesn't clarify if it can contain existing folder features, thereby turning the exist...
- Tue Feb 04, 2025 4:39 pm
- Forum: Macro Library
- Topic: Gemini for macro code?
- Replies: 17
- Views: 7275
Re: Gemini for macro code?
Can we please leave politics out of our forum?
- Mon Feb 03, 2025 5:33 pm
- Forum: Macro Library
- Topic: Gemini for macro code?
- Replies: 17
- Views: 7275
Re: Gemini for macro code?
It'has been decades since I studied AI academically, but there is an important aspect to keep in mind. Along with the result that we get, there is an accompanying CONFIDENCE FACTOR. Without the CF, the result is less useful. Unfortunately, with the AI tools I have seen, we don't get to see the CF. M...
- Mon Feb 03, 2025 4:03 pm
- Forum: Macro Library
- Topic: Gemini for macro code?
- Replies: 17
- Views: 7275
Re: Gemini for macro code?
It's super interesting, the idea that AI can contaminate the very models that it depends on to provide useful responses. Fortunately,, I don't think we have too many concerns about this in the context at hand.
- Mon Feb 03, 2025 11:53 am
- Forum: Macro Library
- Topic: Gemini for macro code?
- Replies: 17
- Views: 7275
Re: Gemini for macro code?
I find AI super useful for exploring other ways of solving problems. It also helps me confirm when API functions I am looking for don't exist becauae AI will hallucinate them. If I had colleagues to work with, perhaps I wouldn't use AI, but for now, I only have AI and thus forum.
- Sat Jan 11, 2025 12:37 am
- Forum: Macro Library
- Topic: Assembly Sort
- Replies: 6
- Views: 953
Re: Assembly Sort
Just declaring a function from the shlwapi.dll . Having this line makes the code more copy past friendly. Otherwise you would need to reference the shlwapi.dll library. Which isn't referenced by default. Does this make sense for you? I get it. Thank you for the explanation. I have to wonder what ot...
- Thu Jan 09, 2025 11:16 pm
- Forum: Macro Library
- Topic: Assembly Sort
- Replies: 6
- Views: 953
Re: Assembly Sort
Can you help me understand the first line:
-Thank You
Code: Select all
Declare PtrSafe Function StrCmpLogicalW Lib "shlwapi" (ByVal s1 As String, ByVal s2 As String) As Integer
-Thank You
- Tue Dec 31, 2024 12:43 am
- Forum: API
- Topic: Table Layers?
- Replies: 1
- Views: 476
Table Layers?
A lot of the VBA Macro tools I write are the bring our legacy drawings up to our current standards. One of the anomalies that we run into is tables that are gray instead of black. The solution to this condition is to manually select them, then put them on the "0" (zero) layer. I'm not sure...
- Wed Dec 25, 2024 9:59 pm
- Forum: API
- Topic: Iterating through every drawing object?
- Replies: 1
- Views: 524
Iterating through every drawing object?
Merry Christmas. I need to write a macro that traverses a drawing and manipulates the layer that objects are on in certain circumstances. I was hoping to be able to iterate through all the objects on each sheet and view, identify what they are, and do something based on some rules. It looks to me li...
- Sat Dec 14, 2024 11:46 pm
- Forum: API
- Topic: How to enable "Thread class" in Hole Wizard Property Manager
- Replies: 4
- Views: 1142
Re: How to enable "Thread class" in Hole Wizard Property Manager
I still have not been able to make this work (2023 SP5). Hoping someone else knows something I don't. Thanks.
- Fri Nov 29, 2024 5:24 pm
- Forum: API
- Topic: How to quickly identify unused variables?
- Replies: 1
- Views: 586
How to quickly identify unused variables?
As I reuse code, I often end up with variables that are not used in my new routines. Identifying remnant variables is a tedious process which is compounded by SolidWork's tendency to frequently crash as I comment out variables I think are unused and then recompile. Do you have any tricks to clean up...
- Thu Nov 07, 2024 8:26 am
- Forum: API
- Topic: How to enable "Thread class" in Hole Wizard Property Manager
- Replies: 4
- Views: 1142
Re: How to enable "Thread class" in Hole Wizard Property Manager
I totally understand your frustration. To enable the "Thread class" checkbox in the Hole Wizard Property Manager, you might want to try using the `swWizHole.ThreadClass` property Thanks, retonny77. Here's a snip of my code swWizHole.ThreadClass = "2B" 'Note that this doesn't see...
- Thu Nov 07, 2024 8:20 am
- Forum: API
- Topic: How do you control the format of a multi-line note?
- Replies: 6
- Views: 1347
Re: How do you control the format of a multi-line note?
Controlling formatting for individual portions of a note is done using SWML. Editing the note formatting using the UI or API calls are really just a way to read and write this SWML. You can use my NoteBrowser macro to read and edit the content of notes and see what the SWML is for certain formats, ...
- Tue Oct 29, 2024 10:49 am
- Forum: API
- Topic: How do you control the format of a multi-line note?
- Replies: 6
- Views: 1347
Re: How do you control the format of a multi-line note?
You could try treating the multi-line note as a paragraph. Get and Set Paragraph Properties Example (VBA) Thanks, SPerman. I didn't think about paragraphs. It's a bit unclear to me where the separation between 'notes' and 'paragraphs' is. This is new territory for me. I'm going to share this code e...
- Mon Oct 28, 2024 10:54 pm
- Forum: API
- Topic: How do you control the format of a multi-line note?
- Replies: 6
- Views: 1347
How do you control the format of a multi-line note?
Using code like
and
I have been able to control the format of simple note annotations.
How does one control the format of multi-line notes? GetTextFormat and SetTextFormat only seem to look at the first line of the note.
Code: Select all
Annot.GetTextFormat(0)
Code: Select all
Annot.ISetTextFormat(i, True, swTextFormat)
How does one control the format of multi-line notes? GetTextFormat and SetTextFormat only seem to look at the first line of the note.
- Sun Oct 27, 2024 9:08 pm
- Forum: API
- Topic: How to enable "Thread class" in Hole Wizard Property Manager
- Replies: 4
- Views: 1142
How to enable "Thread class" in Hole Wizard Property Manager
I am trying to edit the definition of an existing hole wizard hole. I can figure out how to change all the settings in the following image, except I can't figure out how to enable/disable the check box before "Thread class" image.png For example, I use the statement swWizHole.CosmeticThrea...
- Sat Oct 05, 2024 8:27 pm
- Forum: API
- Topic: Assembly "Component Display" setting
- Replies: 2
- Views: 844
Re: Assembly "Component Display" setting
Thank you, RonE. That worked great!
- Thu Sep 26, 2024 12:48 pm
- Forum: SolidWorks PDM
- Topic: Is it a good idea to store Templates/Sheet-Formats/Macros/etc. in the fault?
- Replies: 2
- Views: 928
Is it a good idea to store Templates/Sheet-Formats/Macros/etc. in the fault?
My company is converting all our network drives from Windows file system on local servers into SharePoint drives. We have a team of 12 engineers who use a shared network location to access our Macros, Materials, Appearances, Templates, Sheet Formats, Blocks, Custom Properties, etc. I predict that So...
- Thu Sep 26, 2024 12:47 pm
- Forum: SW General
- Topic: SolidWorks and SharePoint
- Replies: 9
- Views: 2134
SolidWorks and SharePoint
My company is converting all our network drives from Windows file system on local servers into SharePoint drives. We have a team of 12 engineers who use a shared network location to access our Macros, Materials, Appearances, Templates, Sheet Formats, Blocks, Custom Properties, etc. I predict that So...
- Thu Sep 26, 2024 12:14 pm
- Forum: API
- Topic: Running Macros from SharePoint
- Replies: 2
- Views: 887
Running Macros from SharePoint
My company is converting all our network drives from Windows file system on local servers into SharePoint drives. We have a team of 12 engineers who use a shared network location to access our Macros, Materials, Appearances, Templates, Sheet Formats, Blocks, Custom Properties, etc. I predict that So...
- Sun Sep 22, 2024 7:13 pm
- Forum: API
- Topic: How to determine if file is checked out?
- Replies: 3
- Views: 1041
Re: How to determine if file is checked out?
Thanks, mp3-250. I got my code to work, but the messages it is returning don't make complete sense. I'll keep your referenced page handy in case I decide to dig deeper.
- Wed Sep 18, 2024 8:39 pm
- Forum: API
- Topic: Assembly "Component Display" setting
- Replies: 2
- Views: 844
Assembly "Component Display" setting
I am trying to write some VBA that sets the "Component Display" of the assemblies and parts in an assembly to "Default Display". I was hoping to find a method in IComponent2, but am having no luck. Any advice is appreciated.
Thank You,
Thank You,
- Mon Sep 16, 2024 1:55 pm
- Forum: API
- Topic: How to determine if file is checked out?
- Replies: 3
- Views: 1041
How to determine if file is checked out?
I have some code that successfully checks files out, saves them, checks them back in, or undoes checkout. What I can't get it to do is correctly report if a file is checked out. pdmFile.IsLocked always returns FALSE. Here's my code. Function IsCheckedOut(swApp As SldWorks.SldWorks, ByVal pdmVault, h...
- Tue Sep 10, 2024 6:16 pm
- Forum: API
- Topic: Editing Config Specific Props from BOM question
- Replies: 3
- Views: 936
Re: Editing Config Specific Props from BOM question
AlexB,
I'm opening the parts/assemblies as I'm going through a drawing BOM.
I managed to get my code working today, much like I described. Now, to move them to the vault and check them in and figure out how the PDM API...
Thank you for your offer of help. I might just take that you up on that.
I'm opening the parts/assemblies as I'm going through a drawing BOM.
I managed to get my code working today, much like I described. Now, to move them to the vault and check them in and figure out how the PDM API...
Thank you for your offer of help. I might just take that you up on that.
- Tue Sep 10, 2024 1:41 pm
- Forum: API
- Topic: Editing Config Specific Props from BOM question
- Replies: 3
- Views: 936
Editing Config Specific Props from BOM question
I'm writing a macro that will iterate through a BOM and will edit configuration specific properties of parts/assemblies in the BOM. To be clear, I want to edit the part/assembly files themselves. This is a big step beyond anything I have written before and have a question. I know how to traverse the...
- Mon Sep 09, 2024 2:59 pm
- Forum: API
- Topic: Need Help with EditBalloonProperties2
- Replies: 2
- Views: 809
Re: Need Help with EditBalloonProperties2
Thank You, Josh. "BoolStatus = swAnnot.Select3(False, Nothing)" did the trick.
- Mon Sep 09, 2024 10:02 am
- Forum: API
- Topic: Need Help with EditBalloonProperties2
- Replies: 2
- Views: 809
Need Help with EditBalloonProperties2
I'm writing a macro that iterates through a drawing and changes the style of BOM Balloons, but It errors with "Object or variable With block variable not set." Here's the relevent code: For j = 0 To UBound(swAnnotations) If DecodeAnnotType(swAnnot.GetType) = "swNote" Then Set swA...
- Fri Sep 06, 2024 7:55 pm
- Forum: API
- Topic: GetBalloonOptions() alternative?
- Replies: 0
- Views: 676
GetBalloonOptions() alternative?
I'm writing some code to manipulate BOM Balloons. Getting the following balloon properties is straightforward using "Get" statements. (Style, Size, UpperTextStyle, UpperText, LowerTextStyle, LowerText) But when it comes to getting the following properties (CustomSize, ShowQuantity, Quantit...
- Mon Aug 26, 2024 10:34 am
- Forum: API
- Topic: Google Drive and SWP files
- Replies: 1
- Views: 749
Google Drive and SWP files
I use Google Drive to share SolidWorks VBA macros between several machines at both work and home. I have found that macro SWP files that are added to Google Drive using the Windows interface (versus Google Drive in a browser window) are not synced. Have others experienced this issue?
- Mon Jul 08, 2024 7:56 pm
- Forum: API
- Topic: Macro won't run if...
- Replies: 5
- Views: 2215
Re: Macro won't run if...
I have figured out a lot about this issue. It's really not a macro/API issue at all because it affects other command buttons as well. Here we go. image.png There are 3 placed in the SW that I tried placing "new macro" buttons for various macros that I use. I also put a "measuring tool...
- Mon Jul 08, 2024 4:45 pm
- Forum: API
- Topic: Macro won't run if...
- Replies: 5
- Views: 2215
Re: Macro won't run if...
I'll share some videos soon, but in the meantime, I discovered that the behavior is different, depending on where the "new macro" button has been placed. If I put it on the Macro Toolbar, they seem to work on the first click. If I put the "new macro" button on the SW Window Title...
- Sat Jul 06, 2024 8:33 pm
- Forum: API
- Topic: Macro won't run if...
- Replies: 5
- Views: 2215
Macro won't run if...
If I run a macro while a cell in a drawing table is selected, nothing happens on the first click. If I click on the run icon a second time, it works fine. This bahavior happens when running a macro using a "new macro button" in the SW UI or when hitting the "run sub" play button ...
- Mon May 06, 2024 4:01 pm
- Forum: API
- Topic: Need to determine the value of DIM with attached GTOL
- Replies: 1
- Views: 1940
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,
Thanks,
- Fri Nov 24, 2023 4:06 pm
- Forum: Macro Library
- Topic: Reset Light Sources
- Replies: 3
- Views: 2212
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.
- Thu Sep 28, 2023 9:38 am
- Forum: API
- Topic: Unable to Select and Unsuppress Center of Mass Feature
- Replies: 10
- Views: 3052
- Wed Sep 27, 2023 12:06 pm
- Forum: API
- Topic: Unable to Select and Unsuppress Center of Mass Feature
- Replies: 10
- Views: 3052
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...
- Wed Sep 27, 2023 11:58 am
- Forum: API
- Topic: Unable to Select and Unsuppress Center of Mass Feature
- Replies: 10
- Views: 3052
- Wed Sep 27, 2023 8:52 am
- Forum: API
- Topic: Unable to Select and Unsuppress Center of Mass Feature
- Replies: 10
- Views: 3052
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,...
- Wed Aug 23, 2023 11:39 am
- Forum: API
- Topic: Can't Delete Sheet Format AutoZones/Borders
- Replies: 0
- Views: 2113
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...
- Mon Aug 21, 2023 2:07 pm
- Forum: API
- Topic: Can't change Document Property
- Replies: 3
- Views: 1413
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...
- Mon Aug 21, 2023 12:57 pm
- Forum: API
- Topic: Can't change Document Property
- Replies: 3
- Views: 1413
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 ...
- 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: 1427
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?
- Fri Aug 18, 2023 12:39 pm
- Forum: API
- Topic: Determine Configuration Name for each BOM QTY Column?
- Replies: 1
- Views: 1049
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?
- Fri Aug 04, 2023 9:33 am
- Forum: 2D Drawings
- Topic: Row height on revision table
- Replies: 9
- Views: 5008
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).
- Wed Jul 19, 2023 9:33 pm
- Forum: API
- Topic: Macro in the PDM Vault
- Replies: 17
- Views: 5036
Re: Macro in the PDM Vault
What are you guys talking about an "add-in" instead of a macro?
- Thu Apr 06, 2023 2:35 pm
- Forum: API
- Topic: Material Search Add-In
- Replies: 22
- Views: 6819
Re: Material Search Add-In
Thank You!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
- Wed Mar 29, 2023 11:51 pm
- Forum: API
- Topic: Material Search Add-In
- Replies: 22
- Views: 6819
- Tue Mar 28, 2023 8:58 am
- Forum: API
- Topic: Material Search Add-In
- Replies: 22
- Views: 6819
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?