Search found 70 matches
- Sat Dec 14, 2024 11:46 pm
- Forum: API
- Topic: How to enable "Thread class" in Hole Wizard Property Manager
- Replies: 4
- Views: 653
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: 276
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: 653
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: 946
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: 946
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: 946
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: 653
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: 535
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: 573
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: 1445
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: 570
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: 685
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: 535
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: 685
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: 589
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: 589
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: 505
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: 505
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: 386
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: 495
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: 1781
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: 1781
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: 1781
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: 1458
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: 1660
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: 2368
- Wed Sep 27, 2023 12:06 pm
- Forum: API
- Topic: Unable to Select and Unsuppress Center of Mass Feature
- Replies: 10
- Views: 2368
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: 2368
- Wed Sep 27, 2023 8:52 am
- Forum: API
- Topic: Unable to Select and Unsuppress Center of Mass Feature
- Replies: 10
- Views: 2368
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: 1749
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: 1197
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: 1197
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: 1227
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: 909
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: 4243
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: 4109
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: 5651
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: 5651
- Tue Mar 28, 2023 8:58 am
- Forum: API
- Topic: Material Search Add-In
- Replies: 22
- Views: 5651
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?
- Sun Mar 26, 2023 12:16 pm
- Forum: API
- Topic: Solutions to Drawing Table Cell Padding Bug?
- Replies: 0
- Views: 1379
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 ...
- Mon Sep 12, 2022 10:45 am
- Forum: API
- Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
- Replies: 6
- Views: 1026
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.
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.
- Sun Sep 11, 2022 11:56 am
- Forum: API
- Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
- Replies: 6
- Views: 1026
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...
- Sat Sep 10, 2022 10:53 pm
- Forum: API
- Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
- Replies: 6
- Views: 1026
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 ...
- Sat Sep 10, 2022 7:58 pm
- Forum: API
- Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
- Replies: 6
- Views: 1026
Re: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
It must be the byref thingy. Guess I'll have to figure that out. Never rant into that that before.
- Sat Sep 10, 2022 6:42 pm
- Forum: API
- Topic: Doesn't work: GetAmbientLightProperties or SetAmbientLightProperties
- Replies: 6
- Views: 1026
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...
- Fri Jun 03, 2022 8:07 am
- Forum: API
- Topic: How to make an duplicate array of the Selection Manager?
- Replies: 3
- Views: 822
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...
- Thu Jun 02, 2022 7:11 am
- Forum: API
- Topic: How to make an duplicate array of the Selection Manager?
- Replies: 3
- Views: 822
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 ...
- Wed May 18, 2022 8:29 pm
- Forum: API
- Topic: How does one use swCenterMarkConnectionLine_e Enumeration?
- Replies: 1
- Views: 1020
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...
- Mon May 09, 2022 11:52 pm
- Forum: API
- Topic: Custom design check - layers
- Replies: 7
- Views: 2143
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...
- Sat May 07, 2022 8:21 pm
- Forum: API
- Topic: How to identify the "parent" of a Centermark?
- Replies: 1
- Views: 598
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
Thank you