Search found 253 matches

by josh
Fri Sep 29, 2023 1:24 pm
Forum: API
Topic: how to eliminate subassemblies and their components from selection
Replies: 1
Views: 442

Re: how to eliminate subassemblies and their components from selection

Just check each component's parent to make sure it's null. If not, or selection is not a component, de-select. Sorry, not reall code. But something like this for i = selmgr.getselectedobjectounc(-1) to 1 step -1 if selmgr.selobjtype = component thne if not (component.getparent is nothing) then selmg...
by josh
Wed Sep 27, 2023 9:39 am
Forum: API
Topic: Unable to Select and Unsuppress Center of Mass Feature
Replies: 10
Views: 1020

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 Fea...
by josh
Wed Sep 20, 2023 9:11 am
Forum: API
Topic: Component Mirror behaves differently from the UI
Replies: 5
Views: 656

Re: Component Mirror behaves differently from the UI

Yes, there’s a bunch of commands where the UI takes a look at your model and tries to guess what options you’re going to want to use, but there’s nothing in the API to invoke those calculations. One other example is the Mate command, where it analyzes your selections and tells you which mates are ap...
by josh
Thu Sep 14, 2023 5:33 pm
Forum: SW General
Topic: New for SW2024
Replies: 95
Views: 89795

Re: New for SW2024

So.... If you'll check the description of the "save as previous version" function, when you try to save to old version it will analyze your model and tell you what will be incompatible with the old version. You'll then have to delete or cancel and re-model. Similar to what Excel does, but ...
by josh
Wed Sep 13, 2023 11:42 pm
Forum: SW General
Topic: New for SW2024
Replies: 95
Views: 89795

Re: New for SW2024

Being able to pre-create a hole wizard sketch is huge, and should have been possible YEARS ago. My hole patterns use symmetry a LOT, and often with the origin. I wrote a macro that works like the mirror command, except that it will mirror about all selected construction lines... Or if none are selec...
by josh
Wed Sep 13, 2023 8:33 am
Forum: API
Topic: Macro throwing error
Replies: 9
Views: 878

Re: Macro throwing error

Hey, I think I recognize that form...

Yep, if it happens again, definitely hit "debug" and show which line gets highlighted. If we're lucky the VBA debugger will actually hightlight the problem line.
by josh
Fri Sep 08, 2023 11:26 am
Forum: SW General
Topic: New Odd Behaviour: Rollback Bar
Replies: 13
Views: 1373

Re: New Odd Behaviour: Rollback Bar

I know it would be a huge undertaking, but I would love to see two options on every one of those dialogs - "Don't ask again in this session" and "Don't ever ask again". Then some sort of additional explanation and required extra user confirmation would pop up for "Don't ever...
by josh
Fri Sep 08, 2023 9:05 am
Forum: SW General
Topic: New Odd Behaviour: Rollback Bar
Replies: 13
Views: 1373

Re: New Odd Behaviour: Rollback Bar

Is this error message in your list of dismissed messages? If you check the box “Don’t show again” and then click “Stop and repair”, every time you have an error in the tree the rollback bar will automatically go back to the error. Basically the exact behavior you are describing. image.png I have a l...
by josh
Thu Sep 07, 2023 8:25 am
Forum: How To Questions
Topic: Mobius Strip in SW
Replies: 55
Views: 19458

Re: Mobius Strip in SW

Alin wrote: Wed Sep 06, 2023 8:26 pm Could you please upload the SW file?
No need. It's just a 3D mobius with its face offset zero to create a single surface with two 180 degree twists. No longer a mobius.
by josh
Tue Sep 05, 2023 4:42 pm
Forum: API
Topic: Hidden Lines in Drawing
Replies: 9
Views: 806

Re: Hidden Lines in Drawing

Maybe it needs parenthesis on the end? Hopefully one of the macro guru's will chime in. Clearly I'm just speculating. image.png Well... The main reason it was failing is that swModel is never set to anything. Therefore the swModel is the empty object variable value of Nothing. Therefore, "Set ...
by josh
Tue Sep 05, 2023 4:32 pm
Forum: API
Topic: Hidden Lines in Drawing
Replies: 9
Views: 806

Re: Hidden Lines in Drawing

So you have a few lines here that say "Set myView = ".... After this point, myView is a direct reference to that drawing view that gets created. Well, at least it is until later when you say "Set myView ="... something different. So myView is a View object, so you can use all the...
by josh
Tue Sep 05, 2023 2:42 pm
Forum: API
Topic: Hidden Lines in Drawing
Replies: 9
Views: 806

Re: Hidden Lines in Drawing

Recording is useless about 80% of the time. It doesn't capture everything you do, and often the methods it uses are not the right thing if you're writing a macro.

What does your code look like now?
by josh
Tue Sep 05, 2023 1:04 pm
Forum: API
Topic: Pulling Machine data
Replies: 1
Views: 448

Re: Pulling Machine data

https://www.makeuseof.com/tag/see-pc-in ... ba-script/

(First result for the search "vba get system information cpu gpu")
by josh
Mon Sep 04, 2023 3:18 pm
Forum: Macro Library
Topic: Solidworks Sketch > Custom GTOL Symbol Convertor
Replies: 8
Views: 3013

Re: Solidworks Sketch > Custom GTOL Symbol Convertor

Hopefully Rob will see this and reupload.... :D
by josh
Sun Sep 03, 2023 8:16 pm
Forum: Macro Library
Topic: Solidworks Sketch > Custom GTOL Symbol Convertor
Replies: 8
Views: 3013

Re: Solidworks Sketch > Custom GTOL Symbol Convertor

Rob matt there seems to be some issue with the website download... I just tried it and I get an error that the zip file is corrupt. Maybe re-upload by Rob? Rob, I was about to try to write one of these one day, but realized I couldn't figure out how to tell which way a sketched arc was going (CW or...
by josh
Fri Sep 01, 2023 2:07 pm
Forum: SW General
Topic: Drawing Feature Manager Design Tree Useless?
Replies: 10
Views: 1350

Re: Drawing Feature Manager Design Tree Useless?

:lol: Thank you sir! People's interesting problems are a big source of personal education for me...

If you're actually using the macro above, there's actually a more updated version over in the Macro Library.
by josh
Wed Aug 30, 2023 10:32 am
Forum: Macro Library
Topic: Select Features of Selected Bodies
Replies: 0
Views: 750

Select Features of Selected Bodies

I was recently sent a SW file that was an entire machine assembly saved as a part, which just created thousands of solid and surface body features. I needed to clean it up significantly to make it even close to usable, but not knowing the structure or any of the components, it was hard for me to sel...
by josh
Mon Aug 28, 2023 5:57 pm
Forum: API
Topic: How do I set the Custom Property Tab Template from a VB Macro?
Replies: 10
Views: 2402

Re: How do I set the Custom Property Tab Template from a VB Macro?

You are setting a Property of an object. You don't get a return from setting a Property. You only get returns from Methods.
by josh
Mon Aug 21, 2023 7:17 am
Forum: SW General
Topic: Overriding part mass with an equation
Replies: 3
Views: 612

Re: Overriding part mass with an equation

Just don't assign a material. Then you can set your density manually to whatever you want.
image.png
by josh
Tue Aug 15, 2023 11:31 am
Forum: SW General
Topic: make envelope items standard components
Replies: 32
Views: 1297

Re: make envelope items standard components

It shouldn't. It only changes the things that you specifically change. If you select it in the box. Has worked in the past before. Unless there is some thing that I have missed (which is always a possibility) UU You're right. It shouldn't. But it does. At least in 22sp4. I made 2 comps envelope, th...
by josh
Tue Aug 15, 2023 10:20 am
Forum: SW General
Topic: make envelope items standard components
Replies: 32
Views: 1297

Re: make envelope items standard components

It should probably be noted that selecting all envelopes (or any big bunch o’ components) and hitting the “Properties” box may change more than just the property you want. There’s no way to specify “Only change the envelope property”. This will also change suppression states, flexible/rigid, and may...
by josh
Tue Aug 15, 2023 9:34 am
Forum: SW General
Topic: make envelope items standard components
Replies: 32
Views: 1297

Re: make envelope items standard components

This will select all envelope components at any level. You should then be able to toggle envelope off. Sub main() Dim swapp As SldWorks.SldWorks Dim swDoc As SldWorks.AssemblyDoc Dim swComp As SldWorks.Component2 Dim vComps As Variant Set swapp = Application.SldWorks Set swDoc = swapp.ActiveDoc vCom...
by josh
Fri Aug 11, 2023 11:04 am
Forum: How To Questions
Topic: Name assembly constraint on insert
Replies: 3
Views: 558

Re: Name assembly constraint on insert

Here is a macro that will ask you for a name upon completion of the Mate command. SolidWorks only raises the notification at the completion of the command (when you hit the final checkmark and exit the Mate command). So if you add a whole bunch of mates at a time you'll have to remember what to name...
by josh
Thu Aug 03, 2023 5:14 pm
Forum: SW General
Topic: Hatches gone, except one!
Replies: 2
Views: 442

Re: Hatches gone, except one!

Check the file location. May need to have coworker send you sldwks.ptn.

https://help.solidworks.com/2021/englis ... cation.htm


Next time make sure you batten them down.
by josh
Wed Aug 02, 2023 5:22 pm
Forum: API
Topic: call Add-in from Macro
Replies: 4
Views: 593

Re: call Add-in from Macro

Not sure what led you to believe this. Any external program can call any SW API. Your program will still have to launch SW and tell it what to do, but there aren't any features of SW that you can do with a macro that you can't do with basically the same API calls from an external program. I've launc...
by josh
Wed Aug 02, 2023 5:15 pm
Forum: How To Questions
Topic: BOM Item numbers across multipl sheets
Replies: 12
Views: 1440

Re: BOM Item numbers across multipl sheets

The only close to practical way I can think of for this would be to put BOMs on each sheet that are driven by the views on that sheet, then have a macro that would look through all the BOMs in a drawing and sync up the balloon numbers to the BOM on the first sheet. It would not be parametric, if som...
by josh
Wed Jul 05, 2023 3:20 pm
Forum: API
Topic: select a specific sketch block instance via API
Replies: 4
Views: 842

Re: select a specific sketch block instance via API

I can’t figure out any way to get this info. Apparently, the 3D sketch which owns the block instances reports that it contains zero sketchpoints. The sketchpoints do not have a unique ID within the 3D sketch, but they report that they belong to the 3D sketch. Dim swApp As SldWorks.SldWorks Dim swSel...
by josh
Mon Jul 03, 2023 7:48 pm
Forum: API
Topic: I've started a SolidWorks API blog!
Replies: 4
Views: 992

Re: I've started a SolidWorks API blog!

I'm not a software developer, but I do a fair bit of programming in the course of my job. I only write code for use inside my department, but I don't see that exception. And my company would definitely qualify as an enterprise, so I suppose that puts me out of Visual Studio Community...
by josh
Wed Jun 28, 2023 12:10 pm
Forum: SW General
Topic: Smart dimension gives wrong result
Replies: 5
Views: 560

Re: Smart dimension gives wrong result

SolidWorks actually uses VBA to evaluate equations. I notice you are trying to use MOD…. You’re using Excel syntax, which won’t work. Any VBA works. However, for some reason (probably trying to protect users from themselves), the syntax checker that watches what you’re typing will only accept certai...
by josh
Wed Jun 28, 2023 10:09 am
Forum: SW General
Topic: Smart dimension gives wrong result
Replies: 5
Views: 560

Re: Smart dimension gives wrong result

The backslash operator is actually VBA and is used for integer division. I'm a little surprised the equation editor accepts it...

https://learn.microsoft.com/en-us/offic ... h-operator
by josh
Mon Jun 19, 2023 8:30 am
Forum: How To Questions
Topic: Importing IFC Files from Tekla
Replies: 7
Views: 1167

Re: Importing IFC Files from Tekla

Not being able to work with imported IFC files significantly impacts a mid-nine figure $$ multi-year project in quite a negative manner. Greatly appreciate the comments and insight and taking time out of your day to respond. As has been sort of mentioned before... It depends a lot on how the IFC fi...
by josh
Sun Jun 18, 2023 3:20 pm
Forum: SW General
Topic: Configuration Study
Replies: 5
Views: 695

Re: Configuration Study

Insert a Design Table and choose the "Auto Create" option. It will automatically add every feature/dimension/etc. that varies across configs. You can delete the design table afterward if you don't want to keep it.
by josh
Thu Jun 08, 2023 10:14 pm
Forum: Macro Library
Topic: Note Browser/Inspector/Power Editor
Replies: 4
Views: 1291

Re: Note Browser/Inspector/Power Editor

Good suggestions... All are implemented in this version except: Total number of notes in the "Sheets" box is not implemented because accessing the drawing sheet view of inactive sheets is not possible. When you select an inactive sheet in the Sheets box, the macro disables screen update, s...
by josh
Thu Jun 08, 2023 6:34 pm
Forum: SolidWorks PDM
Topic: Advice Setting Up Student Use of PDM Standard
Replies: 16
Views: 1506

Re: Advice Setting Up Student Use of PDM Standard

I don't think Windows Server is required for PDM Standard. Pretty sure I've heard of small offices setting it up on one of the workstations. But I wouldn't take that to the bank. It doesn't sound like the students need PDM Pro.
by josh
Thu Jun 08, 2023 5:44 pm
Forum: SolidWorks PDM
Topic: Advice Setting Up Student Use of PDM Standard
Replies: 16
Views: 1506

Re: Advice Setting Up Student Use of PDM Standard

As long as you don't need remote access or internet, you could easily set up your own wifi network inside the school with a basic PC running the PDM. All you would need is a router.
by josh
Thu Jun 08, 2023 4:56 pm
Forum: API
Topic: open part/assembly from list
Replies: 1
Views: 454

Re: open part/assembly from list

You're just going to have to debug it. Simplify it down until you get it to work. Or start at the bottom. Write a sub with just OpenDoc6 and a hard coded path and see if it works. Work your way out from there. Or post enough stuff here (sample files, etc) so we can recreate your issue. Make it as ea...
by josh
Thu Jun 08, 2023 12:20 pm
Forum: Macro Library
Topic: Note Browser/Inspector/Power Editor
Replies: 4
Views: 1291

Re: Note Browser/Inspector/Power Editor

Updated to show/edit hyperlinks.
by josh
Thu Jun 08, 2023 12:17 pm
Forum: Macro Library
Topic: Display Hidden Lines (with macro)
Replies: 6
Views: 811

Re: Display Hidden Lines (with macro)

I couldn't find any lines that I haven't visited in SW api for two days. Did you know this code or did you find it by calling? I have not yet learned how to find the code or function I need in the SW api. I usually come to a certain point and get stuck at some point. I've seen them but didn't under...
by josh
Thu May 18, 2023 1:15 pm
Forum: SW General
Topic: Performance Test Macro?
Replies: 9
Views: 754

Re: Performance Test Macro?

I wrote a benchmark for a guy once. It's certainly possible but not quite as simple as recording (as you found out). If you feel like it would be of value to have a custom benchmark, feel free to drop me a DM. I enjoy writing SW stuff so I work pretty cheap.
by josh
Mon Apr 24, 2023 11:48 am
Forum: SW General
Topic: STEP AP 242
Replies: 8
Views: 907

Re: STEP AP 242

I bleev it requarz the MBD add-in. Separate $$$.
image.png
image.png (5.6 KiB) Viewed 891 times
by josh
Mon Apr 24, 2023 11:11 am
Forum: Macro Library
Topic: Note Browser/Inspector/Power Editor
Replies: 4
Views: 1291

Note Browser/Inspector/Power Editor

Hi folks, Based on the discussion here (https://www.cadforum.net/viewtopic.php?t=2657 ), I’ve created a macro for exploring all the notes in a drawing. This macro will list all note annotations in the drawing by sheet and view. You can explore all the notes on all sheets of a drawing without actuall...
by josh
Fri Apr 21, 2023 2:56 pm
Forum: How To Questions
Topic: Flexible Printed Circuit Geometry
Replies: 14
Views: 1112

Re: Flexible Printed Circuit Geometry

Will the flexible circuit be completely free in the air other than being clamped on both ends? And it’s all assumed to be elastic deformation, right? You’re not pre-forming it with creased bends? And you’re showing it the same width all the way across too. All the shapes I’m seeing so far have small...
by josh
Fri Apr 21, 2023 11:28 am
Forum: SW General
Topic: Drawing Feature Manager Design Tree Useless?
Replies: 10
Views: 1350

Re: Drawing Feature Manager Design Tree Useless?

See if this macro helps with your workflow... Please note that it's not super debugged. But you can browse and edit notes anywhere in the drawing without actually activating the sheet. The Property Linked Text box shows you the full actual text that is stored in the note, along with any formatting/b...
by josh
Fri Apr 21, 2023 9:41 am
Forum: SW General
Topic: Drawing Feature Manager Design Tree Useless?
Replies: 10
Views: 1350

Re: Drawing Feature Manager Design Tree Useless?

Sooo... Would that be just for notes? If not, what other annotations would be included?
by josh
Fri Apr 21, 2023 8:29 am
Forum: SW General
Topic: Drawing Feature Manager Design Tree Useless?
Replies: 10
Views: 1350

Re: Drawing Feature Manager Design Tree Useless?

What sort of functionality/actions/behavior would you expect from listing up annotations in the feature tree? It would not be difficult to write something or other macro-wise to find/list/etc notes and annotations, I'm just trying to imagine what workflow would be improved by picking them from the f...
by josh
Wed Apr 19, 2023 11:55 am
Forum: How To Questions
Topic: Large Templates / Patterns for Composite Laminating into 2D CAD Drawing.
Replies: 7
Views: 663

Re: Large Templates / Patterns for Composite Laminating into 2D CAD Drawing.

If you do end up going with the wire mesh method, the further away you can get your camera the less distortion you'll have. If you can manage a long distance, high resolution, and high optical zoom you should be able to get pretty minimal distortion.
by josh
Thu Apr 06, 2023 2:48 pm
Forum: SW General
Topic: SOLIDWORKS pet peeves
Replies: 281
Views: 448536

Re: SOLIDWORKS pet peeves

That setting works for me. I've always vehemently hated that auto-flipping function. Maybe you need to check this box too? image.png I can’t imagine a scenario where this flipping would be a beneficial function for anyone. I have an assembly that’s right I’m adding a new mate on a new component. “Oh...
by josh
Tue Mar 21, 2023 10:13 am
Forum: SW General
Topic: SOLIDWORKS pet peeves
Replies: 281
Views: 448536

Re: SOLIDWORKS pet peeves

Dwight wrote: Tue Mar 21, 2023 9:58 am If I change an assembly component to a different configuration, I am peeved that Solidworks flags the component as changed.
What do you mean by "flag as changed"? But, that said, you changed it. Why would it not flag as changed?
by josh
Mon Mar 20, 2023 9:12 am
Forum: SW General
Topic: SOLIDWORKS pet peeves
Replies: 281
Views: 448536

Re: SOLIDWORKS pet peeves

It's not so much of a "workaround" as it is just the normal way. In the beginning, none of the "during creation" Property Manager Pages allowed equation entry or any other sort of linking. Everything had to be linked after creation. They started several releases ago to implement ...
by josh
Thu Mar 16, 2023 4:31 pm
Forum: SW General
Topic: Display configurations with the same name as one item
Replies: 9
Views: 1313

Re: Display configurations with the same name as one item

Thanks, I find as you said that the "User Specified" option does work. I was using the "Document Name" option (see image), which *should* make both part numbers match and operate the same as doing "User Specified", but apparently it doesn't. I *think* it used to work i...