Message 1 of 4
Half Section View by Dimension
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
What is wrong? Does anyone have an idea how to get this to work? GetPosition of type FaceProxy not found.
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then ' MsgBox("Chybně spuštěn dialog! Špatný typ dokumentu." & vbLf & "OK pro Ukončení." & vbLf & "(" & iLogicVb.RuleName & ") ", vbOKOnly + vbCritical, "Funkce Sestavy (iam)") MsgBox("Dialog failed to start! Bad document type." & vbLf & "OK to Exit." & vbLf & "(" & iLogicVb.RuleName & ") ", vbOKOnly + vbCritical, "Assembly function (iam)") Exit Sub End If Dim oInvApp As Inventor.Application = ThisApplication Dim oDoc As Document = oInvApp.ActiveDocument Dim oCM As CommandManager = oInvApp.CommandManager Dim oMT As MeasureTools = oInvApp.MeasureTools Dim oTG As TransientGeometry = oInvApp.TransientGeometry Dim oFace1, oFace2 As Face oFace1 = oCM.Pick(SelectionFilterEnum.kPartFaceFilter, "Select the first face")'Vyber první plochu If oFace1 Is Nothing Then Exit Sub oFace2 = oCM.Pick(SelectionFilterEnum.kPartFaceFilter, "Select the second face") If oFace2 Is Nothing Then Exit Sub Dim oCyl1, oCyl2 As Cylinder If oFace1.SurfaceType = SurfaceTypeEnum.kCylinderSurface Then oCyl1 = oFace1.Geometry If oFace2.SurfaceType = SurfaceTypeEnum.kCylinderSurface Then oCyl2 = oFace2.Geometry Dim result As Double If oCyl1 IsNot Nothing And oCyl2 IsNot Nothing Then Dim oLine1, oLine2 As Line oLine1 = oTG.CreateLine(oCyl1.BasePoint, oCyl1.AxisVector.AsVector()) oLine2 = oTG.CreateLine(oCyl2.BasePoint, oCyl2.AxisVector.AsVector()) result = oMT.GetMinimumDistance(oLine1, oLine2) Else If oCyl1 IsNot Nothing Then result = oMT.GetMinimumDistance(oCyl1.BasePoint, oFace2) Else If oCyl2 IsNot Nothing Then result = oMT.GetMinimumDistance(oFace1, oCyl2.BasePoint) Else result = oMT.GetMinimumDistance(oFace1, oFace2) End If 'MessageBox.Show(result * 10, "Title") 'moje = result '* 10 Dim asm As AssemblyDocument = ThisDoc.Document Dim asmDef As AssemblyComponentDefinition = asm.ComponentDefinition Dim viewRep As DesignViewRepresentation = asmDef.RepresentationsManager.ActiveDesignViewRepresentation Dim rootPoint As Point Dim xAxis, yAxis As UnitVector oFace1.GetPosition(rootPoint, xAxis, yAxis) Dim offset As Double = -result '5 ' 5cm offset MessageBox.Show(result, "Title") Dim planeBasePt As Point = ThisApplication.TransientGeometry.CreatePoint(rootPoint.X + offset, rootPoint.Y, rootPoint.Z) Dim planeNormal As Vector = ThisApplication.TransientGeometry.CreateVector(-1, 0, 0) Dim plane1 As Plane = ThisApplication.TransientGeometry.CreatePlane(planeBasePt, planeNormal) viewRep.SetSectionView(SectionViewTypeEnum.kHalfSectionViewType, plane1)