Does anyone have experience trimming surfaces from the api?
As far as I can tell from the severly lacking help file on the topic, the process for a mutual trim should look something like this:
- Pre-select surfaces that are going to be trimmed
- This is identical to how you would do it from the UI
- swFeatureManager.PreTrimSurface(True, True, False, True)
- This selects mutual trim, let solidworks decide what to trim, naturally extend surfaces, and removed selected surfaces (I think this is selections made after PreTrimSurface is called)
- Select surfaces near the sections that need to be removed
- Here is the tricky part, the example from the help files just has a static location. I am working on logic to find a point on the surface outside of one of the trimming surfaces. But for the mean time I found points in the the sections that I want to trim and hard coded locations like the example.
- Set swFeatureManager.SolidForTrim = False
- I think this is used when you want to knit the surfaces together and form a solid, someone correct me if I'm wrong about this.
- Set swFeature = swFeatureManager.PostTrimSurface(True)
- Not entirely sure what the True/False argument does, I think its supposed to knit surfaces is you select true.
I have been working from this example:
2016 SOLIDWORKS API Help - Create Solid Body Surface Trim Feature Example (VBA)
I end up getting nothing when executing step 5.
I have gotten standard trims to work, but then I would need to knit the surfaces and I can't get swFeatureManager.InsertSewRefSurface to work either. Have any of you tried to do something similar to this? Unfortunately I can't actually share the code or SolidWorks model that I am working with.
I'm quite frustrated over the fact that I can't replicate performance with the exact syntax that the SW help files use. Also their method of selecting everything by name at a hard point is awful, you would never do that in reality it provides no flexibility for selecting objects using logic.
Message was edited by: Trevor Dutrow
SolidworksApi macros