AnsweredAssumed Answered

HELP NEEDED: Trim Surface API

Question asked by Swme Eng on Aug 10, 2017
Latest reply on Aug 11, 2017 by Swme Eng

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:

 

  1. Pre-select surfaces that are going to be trimmed
    1. This is identical to how you would do it from the UI
  2. swFeatureManager.PreTrimSurface(True, True, False, True)
    1. 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)
  3. Select surfaces near the sections that need to be removed
    1. 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.
  4. Set swFeatureManager.SolidForTrim = False
    1. 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.
  5. Set swFeature = swFeatureManager.PostTrimSurface(True)
    1. 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

Outcomes