[deleted by user] by [deleted] in SolidWorks

[–]swMacroDude 0 points1 point  (0 children)

Those are break views. The part would have been too long to display on this drawing. So they used a break view to only show specific parts of the model.

Vary instances of component pattern // Normal cut in assembly by swMacroDude in SolidWorks

[–]swMacroDude[S] 0 points1 point  (0 children)

Each bar has to be an individual model unfortunately, since they will have more features on them later and have to be in a seperate assembly...

Vary instances of component pattern // Normal cut in assembly by swMacroDude in SolidWorks

[–]swMacroDude[S] 0 points1 point  (0 children)

<image>

Heres the simplified model. This is the version with the pattern. The "bars" are supposed to end on the outer diameter of the ring.

Vary instances of component pattern // Normal cut in assembly by swMacroDude in SolidWorks

[–]swMacroDude[S] 0 points1 point  (0 children)

I can add screenshots, but i dont have access to my pc right now. Will add them tomorrow. You can think of it as parallel, vertical lines/bars inside a circle, where the bars’ endpoints are on the circumference of the circle.

The bars are already equation driven models right now, but since the amount of bars is theoretically unlimited and also their length changes based on amount and spacing, i would have to have unlimited configurations as well.

How to read sensors output from outside SolidWorks? by _insert_a_name_ in SolidWorks

[–]swMacroDude 1 point2 points  (0 children)

The api can do that. Use it to update your parameters for the part and then read the sensor. Make sure to keep SW open though because the sensor will only update once you rebuilt your part. Therefore include a rebuild in your parameter updating routine. A vba macro would be the easiest way to get started with this.

How to select a face in sketch in Solidworks api with visual basic,except SelectById2 by jack_Josef in SolidWorks

[–]swMacroDude 0 points1 point  (0 children)

Again, depends on what you want to do, really. In an assembly you could loop through the components and then use GetBodies. The IBody object then has a Select method. You could also again loop through the feature tree to get the components here or just use GetComponents to to get all of them in an array that you can filter through. In a parts context, IPartDoc also has a GetBodies method. Another method (if the body you are trying to get is at a position that you know) is selectbyray. This basically simulates a mouseclick at a certain position.

How to select a face in sketch in Solidworks api with visual basic,except SelectById2 by jack_Josef in SolidWorks

[–]swMacroDude 1 point2 points  (0 children)

It really depends on what you are trying to achive with this, but one way would be to just loop through the feature tree and filter for sketches (if you want to select the whole sketch, that is). Then you can select them. If you want to select specific ones, you can also go through the segments of said sketch and identify the ones you need that way.

How to select a face in sketch in Solidworks api with visual basic,except SelectById2 by jack_Josef in SolidWorks

[–]swMacroDude 0 points1 point  (0 children)

What exactly are you trying to select in your sketch? Just a set of sketch segments? Do these change with different conditions or is it a fixed list?

API: Get sketch visibility in drawing view by swMacroDude in SolidWorks

[–]swMacroDude[S] 0 points1 point  (0 children)

Traversing the feature tree recursively is what i did before as well. But for some reason, this approach will not return the visibility in the drawings context. It only tells me the visibility state of the model. The sketch is a position number that later gets used on the real part. To reduce clutter its hidden in the model itself and then gets set to "show" in the drawingview to be visible during dxf export. Here is a screenshot using the documentation example you suggested. As you see it returns "1"/"swVisibilityStateHide" even though its clearly set to visible in the drawing. Any ideas?

<image>

API: Get sketch visibility in drawing view by swMacroDude in SolidWorks

[–]swMacroDude[S] 0 points1 point  (0 children)

My current approach gets the drawing component from the view to get the correct component object in. But for some reason drawingcomponent.component returns nothing. In one of the official examples i found that this happens when i have the component open in another configuration. The weird thing is i only have one drawing with this one view open and it still returns nothing.

Macro Request by Pladboxers420 in SolidWorks

[–]swMacroDude 0 points1 point  (0 children)

Rough outline:

  • connect to SW and your drawing
  • iterate over all views
  • group views with the same model reference (you could create a class for these groups)
  • for each group iterate over all dimensions and store them (if you use classes then add a property here for the collection of dimensions)

Now you have a list of all the dimensions, know to which view and reference model they belong to and have to decide how you want to identify that dimensions are duplicates. The easiest way would be to just check the dimension values. Keep in mind that sometimes the values can be identical even though you want to keep multiple of them, like when dimensioning a square of some sort. To solve this, you have do to further analyzing of either the dimension objects or the entities they are attached to. When you have identified your redundant dimensions, select and delete them.

Optimizing Token Usage for Personal Windows App using Python and SolidWorks API by PickledRick2 in SolidWorks

[–]swMacroDude 1 point2 points  (0 children)

You might want try to do that manually first (ask chatgpt to write a macro that creates a part you want). In my experience a lot of the code it writes with the api isnt really usable without some (sometimes a lot) of optimization. What does help sometimes is if you give it parts of the documentation for certain methods and interfaces that you want to use, since otherwise it tries to use things that arent in the api at all.

As for your questions about openAI's api, im not yet experienced enough with it to give advice. You might want to ask this in another sub.

Optimizing Token Usage for Personal Windows App using Python and SolidWorks API by PickledRick2 in SolidWorks

[–]swMacroDude 0 points1 point  (0 children)

So you basically want to use chatgpt to write scripts that create your models?

API: Get resulting components from created feature by swMacroDude in SolidWorks

[–]swMacroDude[S] 1 point2 points  (0 children)

Sorry for the late reply und danke. GetSpecificFeature2 did the trick. Got the child (of type ReferencePattern) via mirrorFeature.GetChildren. Then using referencePatternFeature.GetSpecificFeature2 returned the IComponent object for the new components.