Solid Edge Assembly Type Library > Occurrence Object : HasBodyOverride Property |
Creation of an assembly feature, for example, on an Occurrence of an assembly results in an override body being created for the Occurrence in the context of the assembly. Solid Edge uses the override body in place of the body from the Occurrence document in the assembly for display, interference analysis etc.
Visual Basic |
---|
Public Property HasBodyOverride As Boolean |
A return value of True implies that the design model in the Part document of the Occurrence has alternate geometry in the context of the assembly.
When objXYZ.HasBodyOverride=True, the override body may be accessed by the method objXYZ.Body where objXYZ is an object of type Occurrence and objXYZ.Subassembly=FALSE.
This method returns the body in the assembly space where the override was created and not in the original part space, therefore Occurrence transform should not be directly applied to the body geometry.
Member of SolidEdgeAssembly.Occurrence
Property HasBodyOverride As Boolean (read-only)
Imports System.Runtime.InteropServices Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim objApplication As SolidEdgeFramework.Application = Nothing Dim objDocuments As SolidEdgeFramework.Documents = Nothing Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing Dim objOccurrences As SolidEdgeAssembly.Occurrences Dim Ref1 As SolidEdgeGeometry.Body = Nothing Dim objTopoRef As SolidEdgeAssembly.TopologyReference = Nothing Dim RefKey(1) As Byte Dim RefKeySize As Integer Dim objObject As Object = Nothing Dim nType As SolidEdgeConstants.ObjectType Dim objFaceRef As SolidEdgeAssembly.TopologyReference Dim objFace As SolidEdgeGeometry.Face Dim objOverrideBodyFaces As SolidEdgeGeometry.Faces Dim objOccurrence As SolidEdgeAssembly.Occurrence = Nothing Dim objOccurrence2 As SolidEdgeAssembly.Occurrence = Nothing Dim i As Integer Try objApplication = Marshal.GetActiveObject("SolidEdge.Application") objApplication.Visible = True objDocuments = objApplication.Documents objAssemblyDocument = objApplication.ActiveDocument objOccurrences = objAssemblyDocument.Occurrences For i = 1 To objOccurrences.Count objOccurrence = objOccurrences.Item(i) If objOccurrence.HasBodyOverride = True And objOccurrence.Subassembly = False Then 'Create Ref1 so that it can be used for further operations Ref1 = objOccurrence.Body objOverrideBodyFaces = Ref1.Faces(SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll) objFace = objOverrideBodyFaces(1) nType = objFace.Type ' Create a Reference to the first face of the override body objFaceRef = objAssemblyDocument.CreateReference2(objOccurrence, objFace) nType = objFaceRef.Type 'Get RefKey objFaceRef.GetReferenceKey(RefKey, RefKeySize) objOccurrence.CreateTopologyReferenceToBodyOverride(RefKey, objObject) 'Rebind the stored refkey to get the object objAssemblyDocument.BindKeyToObject(RefKey, objObject) nType = objObject.Type() End If Next Catch ex As Exception MsgBox(ex.Message) Clipboard.SetText(ex.ToString) End Try End Sub End Class