Search found 9 matches

by mario malic
Sat Apr 13, 2024 11:27 am
Forum: API
Topic: Find touching face in a multi-body part
Replies: 9
Views: 690

Re: Find touching face in a multi-body part

Is it feasible for user to select any feature (solid/surface/edge/point) on the second body so you can get its reference, then your macro can only search for faces on the second body? Otherwise, you can try finding bodies whose bounding box (GetBodyBox method) intersects, however, it's not robust. Y...
by mario malic
Mon Oct 30, 2023 7:07 am
Forum: API
Topic: Rotation of component in 3D space
Replies: 2
Views: 595

Re: Rotation of component in 3D space

Thank you for the reply Josh. I did not really understand the issue at the time when I was posting the question. I thought, if I rotate the component 45°w.r.t. assembly X-axis, followed by 45°w.r.t. assembly Y-axis, followed by 45°w.r.t. assembly Z-axis, the component will be oriented by that angle ...
by mario malic
Wed Oct 18, 2023 7:11 am
Forum: API
Topic: Rotation of component in 3D space
Replies: 2
Views: 595

Rotation of component in 3D space

Hi guys, I want to place a component in assembly with particular orientation w.r.t. to origin axes. I have managed to successfully rotate a component about 1 axis by getting a RotationMatrix, and applying SetTransformAndSolve3 to the component. Function RotXMatrix(ByRef swComp As Component2, ByRef s...
by mario malic
Mon Oct 02, 2023 3:34 am
Forum: API
Topic: Getting a reference to a component body selected from the FeatureManager tree
Replies: 6
Views: 698

Re: Getting a reference to a component body selected from the FeatureManager tree

As Josh said, GetSelectedObjectsComponent4 should get it. I tried getting it this way, but it didn't work for some reason on SW2021 (I might have made a mistake trying to get it), but this works on SW2022. Sub main() Dim swApp As SldWorks.SldWorks Dim swDoc As SldWorks.ModelDoc2 Dim swSelMgr As SldW...
by mario malic
Sun Oct 01, 2023 3:56 pm
Forum: API
Topic: Getting a reference to a component body selected from the FeatureManager tree
Replies: 6
Views: 698

Re: Getting a reference to a component body selected from the FeatureManager tree

When you say component, do you mean Cube<2> for that particular selection? If so, this should be fine. Sub main() Dim swApp As SldWorks.SldWorks Dim swDoc As SldWorks.ModelDoc2 Dim swSelMgr As SldWorks.SelectionMgr Dim swSelData As SldWorks.SelectData Dim swBody As SldWorks.Body2 Dim bool As Boolean...
by mario malic
Thu Sep 21, 2023 12:21 pm
Forum: API
Topic: Component Mirror behaves differently from the UI
Replies: 5
Views: 666

Re: Component Mirror behaves differently from the UI

I think it should be something related to this member ComponentOrientationsAlignToComponentOrigin. If you mirror every single component in the same way with the default option swOrientation_MirroredX_MirroredY. Components have their own coordinate systems and I believe this is the issue when you are...
by mario malic
Fri Jun 02, 2023 8:01 am
Forum: API
Topic: Save As 3mf macro
Replies: 8
Views: 946

Re: Save As 3mf macro

I would suggest to record a macro yourself in which you will save as .3mf format and see if there are any differences between recorded one and yours.
by mario malic
Thu Apr 13, 2023 4:41 am
Forum: API
Topic: Getting surface model vertex coordinates
Replies: 3
Views: 664

Re: Getting surface model vertex coordinates

As mentioned above, it is possible to do it with a vertex object. It is an old thread, but posting for a complete solution. There are some extra unneccessarry objects since I used this macro for other purpose, but the vertex coords are found in ptVar variant. Dim swApp As SldWorks.SldWorks Sub main(...