Inventor Customization

Reply
Valued Mentor
stephengibson76
Posts: 1,117
Registered: ‎08-01-2006
Message 1 of 13 (461 Views)

split all intersecting surfaces

461 Views, 12 Replies
02-07-2013 01:54 AM

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


ADN Support Specialist
xiaodong.liang
Posts: 1,306
Registered: ‎06-12-2011
Message 2 of 13 (439 Views)

Re: split all intersecting surfaces

02-17-2013 07:35 PM in reply to: stephengibson76

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

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Valued Mentor
stephengibson76
Posts: 1,117
Registered: ‎08-01-2006
Message 3 of 13 (422 Views)

Re: split all intersecting surfaces

02-26-2013 04:07 AM in reply to: xiaodong.liang

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

Stephen Gibson



View stephen gibson's profile on LinkedIn


Valued Mentor
stephengibson76
Posts: 1,117
Registered: ‎08-01-2006
Message 4 of 13 (417 Views)

Re: split all intersecting surfaces

02-26-2013 05:18 AM in reply to: xiaodong.liang

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


Valued Mentor
stephengibson76
Posts: 1,117
Registered: ‎08-01-2006
Message 5 of 13 (361 Views)

Re: split all intersecting surfaces

03-04-2013 02:05 AM in reply to: stephengibson76

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

 

Stephen Gibson



View stephen gibson's profile on LinkedIn


ADN Support Specialist
Vladimir.Ananyev
Posts: 514
Registered: ‎08-14-2012
Message 6 of 13 (352 Views)

Re: split all intersecting surfaces

03-04-2013 01:57 PM in reply to: stephengibson76

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

Valued Mentor
stephengibson76
Posts: 1,117
Registered: ‎08-01-2006
Message 7 of 13 (344 Views)

Re: split all intersecting surfaces

03-05-2013 03:34 AM in reply to: Vladimir.Ananyev

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


Valued Mentor
stephengibson76
Posts: 1,117
Registered: ‎08-01-2006
Message 8 of 13 (333 Views)

Re: split all intersecting surfaces

03-05-2013 08:59 AM in reply to: stephengibson76

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

Stephen Gibson



View stephen gibson's profile on LinkedIn


ADN Support Specialist
Vladimir.Ananyev
Posts: 514
Registered: ‎08-14-2012
Message 9 of 13 (329 Views)

Re: split all intersecting surfaces

03-05-2013 12:25 PM in reply to: stephengibson76

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


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Valued Mentor
stephengibson76
Posts: 1,117
Registered: ‎08-01-2006
Message 10 of 13 (299 Views)

Re: split all intersecting surfaces

03-07-2013 04:40 AM in reply to: Vladimir.Ananyev

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


Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!