Dim symbolDefinition As IpfcDetailSymbolDefItem Dim symInstructions As IpfcDetailSymbolInstInstructions '加载符号文件,注意这里没有进行校验 symbolDefinition = drawing.RetrieveSymbolDefinition(Symbolfile, CObj(Symbolpath), Nothing, True) '初始化并设置symInstructions的值 symInstructions = (New CCpfcDetailSymbolInstInstructions).Create(symbolDefinition)
Dim Texts AsNew Dictionary(OfString, String) From { {"roughness_height", "6.3"} } PrivateFunction SetDetailVariantTexts(ByVal Dicts As Dictionary(OfString, String)) As CpfcDetailVariantTexts Dim varText As IpfcDetailVariantText If Dicts.Count > 0Then SetDetailVariantTexts = New CpfcDetailVariantTexts ForEachtextAs KeyValuePair(OfString, String) In Dicts varText = (New CCpfcDetailVariantText).Create(text.Key, text.Value) SetDetailVariantTexts.Append(varText) Next Else SetDetailVariantTexts = Nothing EndIf Return SetDetailVariantTexts EndFunction
''' <summary> ''' 设置IpfcDetailSymbolInstInstructions的SymbolDefAttachment ''' </summary> ''' <param name="AttachOnDefType">符号放置方式</param> ''' <param name="selectedObject">放置点</param> ''' <returns>SymbolDefAttachment对象</returns> PrivateFunction SetSymbolDefAttachment(ByVal AttachOnDefType As EpfcSymbolDefAttachmentType, ByVal selectedObject As IpfcSelection) As IpfcSymbolDefAttachment Return (New CCpfcSymbolDefAttachment).Create(AttachOnDefType, selectedObject.Point) EndFunction
''' <summary> ''' 选择获取一个对象,这里为简化代码,未进行有效性检测 ''' </summary> ''' <param name="filter">选择对象类型,默认为边</param> ''' <returns>选择对象</returns> PrivateFunction SelectObject(OptionalByVal filter AsString = "edge") As IpfcSelection Dim selections As CpfcSelections Dim selectionOptions As IpfcSelectionOptions '====================================================================== '这里为简化代码,未对selectEdge进行检测 '====================================================================== selectionOptions = (New CCpfcSelectionOptions).Create(filter) selectionOptions.MaxNumSels = 1 selections = asyncConnection.Session.Select(selectionOptions, Nothing) SelectObject = selections.Item(0) Return SelectObject EndFunction
''' <summary> ''' 获取鼠标点击位置 ''' </summary> ''' <returns></returns> PrivateFunction MousePosAttatchement() As IpfcAttachment Dim point As CpfcPoint3D Dim mouse As IpfcMouseStatus point = New CpfcPoint3D mouse = asyncConnection.Session.UIGetNextMousePick(EpfcMouseButton.EpfcMOUSE_BTN_LEFT) point = mouse.Position MousePosAttatchement = (New CCpfcFreeAttachment).Create(point) Return MousePosAttatchement EndFunction
''' <summary> ''' 生成Leaders ''' </summary> ''' <param name="leader"></param> ''' <param name="position"></param> ''' <returns>生成的leaders</returns> PrivateFunction SetAttatchements(ByVal leader As IpfcAttachment, ByVal position As IpfcAttachment) As IpfcDetailLeaders Dim attachments As CpfcAttachments SetAttatchements = (New CCpfcDetailLeaders).Create() SetAttatchements.ItemAttachment = position SetAttatchements.ElbowLength = Nothing If (leader IsNotNothing) Then attachments = New CpfcAttachments attachments.Insert(0, leader) SetAttatchements.Leaders = attachments EndIf Return SetAttatchements EndFunction