Hi,
I got a part of a plugin that doest work somehow.
If it doesnt split I return the original but it also says it does not exist. Sometimes. Not always
- Extrude is a Solid
- Mesh is to trim Mesh
Private Function CreateTrim (Byval Mesh as geometry.Mesh, Byval Extrude as Guid)
Dim NewSrf As Geometry.Brep = New DocObjects.ObjRef(Extrude).BrepDim ElementObjRef As New DocObjects.ObjRef(Mesh)Dim ElementMesh As Geometry.Mesh = ElementObjRef.MeshDim Splitted As Geometry.Mesh() = ElementMesh.Split(Rhino.Geometry.Mesh.CreateFromBrep(NewSrf))
Dim MyMesh As Guid = Mesh
If Splitted IsNot Nothing Then
For Each Splits As Geometry.Mesh In Splitted
If Splits IsNot Nothing Then
Dim AddedMesh As Guid = doc.Objects.AddMesh(Splits)
If AddedMesh <> Nothing Then
Dim maxZMesh As Double = Functions.GetMaxZMesh(AddedMesh) 'Get Boundingbox.Max.Z
Dim maxZDupplicate As Double = Functions.GetMaxZBrep(Extrude) 'Get Boundingbox.max.z
If maxZDupplicate >= maxZMesh And DocMesh.Mesh.Vertices.Count > 250 Then
doc.Objects.Delete(MyMesh, True)
MyMesh = AddedMesh
Else
doc.Objects.Delete(AddedMesh, True)
End If
End If
End If
Next
If MyMesh <> Mesh Then
doc.Objects.Delete(Mesh, True)
End If
End If
doc.Objects.Delete(Extrude, True)
Return MyMesh
End Function
Cant get the box too work so it is a bit messy. Sorry for that.
Anyone knows whats going wrong?

but I do see this line