Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

split all intersecting surfaces

12 REPLIES 12
Reply
Message 1 of 13
stephengibson76
690 Views, 12 Replies

split all intersecting surfaces

is there a command or workflow to split all intersecting surfaces?  currently we build surface models and split manually or open in autocad, explode, overkill, breakall, then export the lines for rebuilding in an FE package.

 

Ideally we would like to export straight from inventor with one hit

 

See attached part, i would like to do the 5 splits below the EOP marker automatically

 

 

Stephen Gibson



View stephen gibson's profile on LinkedIn


12 REPLIES 12
Message 2 of 13

Hi,

 

Hope the following code is what you are looking for.

 

Sub Split()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    Dim oCompDef As PartComponentDefinition
    Set oCompDef = oDoc.ComponentDefinition
    
'    Dim oPl As WorkPlane
'    Set oPl = oCompDef.WorkPlanes("XZ Plane")
    
    'arguments
    Dim oWS1 As WorkSurface
    Set oWS1 = oCompDef.WorkSurfaces(1)
    
    Dim oObjColl As ObjectCollection
    Set oObjColl = ThisApplication.TransientObjects.CreateObjectCollection()
    
    
     Dim oSurface As SurfaceBody 'WorkSurface
      Set oSurface = oCompDef.WorkSurfaces.Item(2).SurfaceBodies(1)
            
        Dim oFace As Face
        For Each oFace In oSurface.Faces
            oObjColl.Add oFace
        Next
            
    
    
    Dim oSplit As SplitFeature
    Set oSplit = oCompDef.Features.SplitFeatures.SplitFaces(oWS1, False, oObjColl)
   
End Sub

 

Message 3 of 13

thanks for the reply, i have been on leave...  i will try it today hopefully

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 4 of 13

I tried it and it only does (split 2) if you pull down the EOP marker.

 

I want to split every intersecting surface on a model that may have 1000 surfaces.

 

I gues it would run something like,

 

List all visible surfaces

split surface 1 with surface 2

split surface 1 with surface 3

split surface 1 with surface xxx

 

split 2 with 3

2 with 4

etc etc

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 5 of 13

this would be so useful...  i cant see any software that does it...

 

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 6 of 13

Try this demo on your model.  This code uses the idea of Xiaodong in two loops.

Sub Split_2()

  Dim oDoc As PartDocument
  Set oDoc = ThisApplication.ActiveDocument
  Dim oCompDef As PartComponentDefinition
  Set oCompDef = oDoc.ComponentDefinition
  
  'The 1st work surface
  Dim oWS1 As WorkSurface
  Set oWS1 = oCompDef.WorkSurfaces.Item(1)
  
  Dim N As Integer
  N = oCompDef.WorkSurfaces.count
    
  Dim oObjColl As ObjectCollection
  Set oObjColl = ThisApplication.TransientObjects.CreateObjectCollection()
  
  Dim i As Integer
  Dim oSurface As SurfaceBody
  Dim oFace As Face
  Dim oSplit As SplitFeature
  
  For i = 2 To N
     Call oObjColl.Clear
     Set oSurface = oCompDef.WorkSurfaces.Item(i).SurfaceBodies(1)
     For Each oFace In oSurface.Faces
         oObjColl.Add oFace
     Next
     Set oSplit = oCompDef.Features.SplitFeatures _
           .SplitFaces(oWS1, False, oObjColl)
   Next i
   
   
  For i = 2 To N
     Call oObjColl.Clear
     For Each oFace In oWS1.SurfaceBodies(1).Faces
         oObjColl.Add oFace
     Next
     Set oSurface = oCompDef.WorkSurfaces.Item(i).SurfaceBodies(1)
     Set oSplit = oCompDef.Features.SplitFeatures _
           .SplitFaces(oSurface, False, oObjColl)
  Next i

  Beep
End Sub

I hope that the idea is clear, and you can customize this code to suit your needs.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 7 of 13

This seems to work perfectly on the test model and Ive added a few more surfaces  that also seem to work, dropped into femap and meshed instantly with no problems...

 

thankyou very much, I am going to try it on a proper model now and let you know the results, this could save me a lot of time

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 8 of 13

is there a way to just list and act on the visible surfaces?

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 9 of 13

No problem.
You may exclude any work surface if its property Visible returns False.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 10 of 13

is there a maximum number of surfaces this can handle? it counts all of the surfaces correctly but doesnt split them all over a certain number.  i tried on a real model then came back and tested against the attached part...

 

also it would be good if it automatically deleted failed splits that dont intersect

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 11 of 13

ok, I understand a bit better, it is only splitting based on the worksurface, i need it to split every surface that intersects another so I am missing any surfaces off this plane...

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 12 of 13

This has risen again... can anyone think of an easy way to do this? ideally automated

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 13 of 13

Hi 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report