''' <summary>
''' Неуказанная шероховатость
''' </summary>
''' <param name="k"></param>
''' <param name="oDrawDoc"></param>
''' <param name="Version"></param>
''' <param name="Type"></param>
''' <param name="ST1"></param>
''' <param name="ST2"></param>
''' <param name="ST3"></param>
''' <param name="ST4"></param>
''' <param name="BaseLeng"></param>
''' <param name="PType"></param>
''' <param name="Direction"></param>
''' <param name="Polka"></param>
''' <param name="Circle"></param>
''' <param name="ForceTail"></param>
''' <param name="Brackets"></param>
''' <param name="STVersion"></param>
''' <param name="DialogType"></param>
''' <param name="Upturned"></param>
Public Sub GlobalSurface(k As Integer, oDrawDoc As DrawingDocument, Optional Version As Integer = 0, Optional Type As Integer = 0,
Optional ST1 As String = "", Optional ST2 As String = "", Optional ST3 As String = "", Optional ST4 As String = "",
Optional BaseLeng As String = "", Optional PType As String = "", Optional Direction As Integer = 0, Optional Polka As Integer = 0,
Optional Circle As Integer = 0, Optional ForceTail As Integer = 0, Optional Brackets As Integer = 0, Optional STVersion As Integer = 0,
Optional DialogType As Integer = 0, Optional Upturned As Integer = 0)
Dim BaseLineLength As Double = 0
Dim UpLineLength As Double = 0
Dim LineDistance As Double = 0.19
Dim oTG As TransientGeometry
oTG = g_inventorApplication.TransientGeometry
Dim oSheet As Sheet
oSheet = oDrawDoc.ActiveSheet
Dim oSketchSymDef As SketchedSymbolDefinition
Dim oSketch As DrawingSketch
oSketchSymDef = oDrawDoc.SketchedSymbolDefinitions.Add("Неуказанная шероховатость:" & k)
Call oSketchSymDef.Edit(oSketch)
Dim oSketchLine, oSketchLine1 As SketchLine
oSketchLine = oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(-0.1 / Math.Tan(3.14 / 3), 0.1))
Call oSketch.GeometricConstraints.AddGround(oSketchLine)
oSketchLine = oSketch.SketchLines.AddByTwoPoints(oSketch.SketchLines.Item(1).StartSketchPoint, oTG.CreatePoint2d(0.21 / Math.Tan(3.14 / 3), 0.21))
Call oSketch.GeometricConstraints.AddGround(oSketchLine)
Dim oTextBox As TextBox
Dim sText1 As String
sText1 = "<StyleOverride FontSize='0,1'>" & ST1 & "</StyleOverride><StyleOverride FontSize='0,13'> ( )</StyleOverride>"
oTextBox = oSketch.TextBoxes.AddFitted(oTG.CreatePoint2d(0.1251, 0.03), sText1)
oTextBox.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextLower
oTextBox.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
Dim oBox2d As Box2d
Dim x As Double
oBox2d = oTextBox.RangeBox
x = oBox2d.MaxPoint.X
Select Case Type
Case 2
Call oSketch.SketchCircles.AddByCenterRadius(oTG.CreatePoint2d(0, 0.3497), 0.35 / 2)
End Select
Select Case Polka
Case 1
oSketchLine = oSketch.SketchLines.AddByTwoPoints(oSketch.SketchLines.Item(2).EndSketchPoint, oTG.CreatePoint2d(x + 0.01, oSketch.SketchLines.Item(2).EndSketchPoint.Geometry.Y))
UpLineLength = oSketchLine.Length
End Select
oSketchLine1 = oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(x - 0.12, 0.03), oTG.CreatePoint2d(x - 0.12 - 0.0667 / Math.Tan(3.14 / 3), 0.0967))
Call oSketch.GeometricConstraints.AddGround(oSketchLine1)
oSketchLine = oSketch.SketchLines.AddByTwoPoints(oSketchLine1.StartSketchPoint, oTG.CreatePoint2d(x - 0.12 + 0.1333 / Math.Tan(3.14 / 3), 0.1633))
Call oSketch.GeometricConstraints.AddGround(oSketchLine)
Dim oSketchPoint As SketchPoint
oSketchPoint = oSketch.SketchPoints.Add(oTG.CreatePoint2d(x + 0.11, 0.21 + 0.11))
oSketchPoint.InsertionPoint = True
For Each oSketchLine In oSketch.SketchLines
oSketchLine.LineWeight = 0.045
Next
Call oSketchSymDef.ExitEdit(True)
Dim oSketchedSymbol As SketchedSymbol
Select Case oSheet.Orientation
Case PageOrientationTypeEnum.kLandscapePageOrientation
oSketchedSymbol = oSheet.SketchedSymbols.Add(oSketchSymDef, oTG.CreatePoint2d(oSheet.Width - 0.5, oSheet.Height - 0.5), , 5.25)
Case PageOrientationTypeEnum.kPortraitPageOrientation
oSketchedSymbol = oSheet.SketchedSymbols.Add(oSketchSymDef, oTG.CreatePoint2d(oSheet.Width - 0.5, oSheet.Height - 1.9), , 5.25)
End Select
Dim oAttributeSet As AttributeSet
Try
oAttributeSet = oSketchedSymbol.AttributeSets.Add("com_autodesk_MSD_AIS_Gost")
Catch ex As Exception
oAttributeSet = oSketchedSymbol.AttributeSets.Item("com_autodesk_MSD_AIS_Gost")
End Try
Dim oAttr As Inventor.Attribute
oAttr = oAttributeSet.Add("Symbol_Type", ValueTypeEnum.kStringType, "Global_Surface_Texture")
oAttr = oAttributeSet.Add("Version", ValueTypeEnum.kIntegerType, Version)
oAttr = oAttributeSet.Add("Type", ValueTypeEnum.kIntegerType, Type)
oAttr = oAttributeSet.Add("ST1", ValueTypeEnum.kStringType, ST1)
oAttr = oAttributeSet.Add("ST2", ValueTypeEnum.kStringType, ST2)
oAttr = oAttributeSet.Add("ST3", ValueTypeEnum.kStringType, ST3)
oAttr = oAttributeSet.Add("ST4", ValueTypeEnum.kStringType, ST4)
oAttr = oAttributeSet.Add("BaseLeng", ValueTypeEnum.kStringType, BaseLeng)
oAttr = oAttributeSet.Add("PType", ValueTypeEnum.kStringType, PType)
oAttr = oAttributeSet.Add("Direction", ValueTypeEnum.kIntegerType, Direction)
oAttr = oAttributeSet.Add("Polka", ValueTypeEnum.kIntegerType, Polka)
oAttr = oAttributeSet.Add("Circle", ValueTypeEnum.kIntegerType, Circle)
oAttr = oAttributeSet.Add("ForceTail", ValueTypeEnum.kIntegerType, ForceTail)
oAttr = oAttributeSet.Add("Brackets", ValueTypeEnum.kIntegerType, Brackets)
oAttr = oAttributeSet.Add("STVersion", ValueTypeEnum.kIntegerType, STVersion)
oAttr = oAttributeSet.Add("BaseLineLength", ValueTypeEnum.kIntegerType, BaseLineLength)
oAttr = oAttributeSet.Add("UpLineLength", ValueTypeEnum.kDoubleType, UpLineLength)
oAttr = oAttributeSet.Add("LineDistance", ValueTypeEnum.kDoubleType, 0.19)
oAttr = oAttributeSet.Add("DialogType", ValueTypeEnum.kIntegerType, LineDistance)
oAttr = oAttributeSet.Add("Upturned", ValueTypeEnum.kIntegerType, Upturned)
Dim oNativeBrowserNodeDef As NativeBrowserNodeDefinition
Dim oTopBrowserNode As BrowserNode
Dim oNode As BrowserNode
oNativeBrowserNodeDef = oDrawDoc.BrowserPanes.GetNativeBrowserNodeDefinition(oSketchSymDef)
oTopBrowserNode = oDrawDoc.BrowserPanes.ActivePane.TopNode
oNode = oTopBrowserNode.AllReferencedNodes(oNativeBrowserNodeDef).Item(1)
oNode.Visible = False
oNativeBrowserNodeDef = oDrawDoc.BrowserPanes.GetNativeBrowserNodeDefinition(oSketchedSymbol)
oTopBrowserNode = oDrawDoc.BrowserPanes.ActivePane.TopNode
oNode = oTopBrowserNode.AllReferencedNodes(oNativeBrowserNodeDef).Item(1)
oNode.Visible = False
'
End Sub