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
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.CreateObjectColle
ction() 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
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
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.CreateObjectColle
ction() 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.
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
You may exclude any work surface if its property Visible returns False.
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
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register