- Yeni Olarak İşaretle
- Sık Kullanılan
- Takip Et
- Sessize al
- RSS Akışını Takip Et
- Vurgula
- Yazdır
- Bildir
Lazere gidecek olan parçaları lazer templatesine atıyoruz. Lakin silindirde bükülecek parçalarda bu liste içerisinde kesiliyor. Usta radius değerine bakmadığı için açılı olarak büküp geri gönderiyor. Bu lazer templatesinde 10dan büyük radiuslu bükümlerde büküm notunu ve büküm markalama çizgisini silmek ve aynı zamanda büküm notuna açık ve kapalı notu eklemek istiyoruz. Aşağıda şimdiye kadar kullandığımız kodları bırakıyorum.
Kayıt esnasında üst üste not eklemesin diye her seferinde notları silen bu komutu kullanıyoruz
Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument For Each oSheet In oDoc.Sheets oSheet.Activate() For Each oNote As BendNote In oSheet.DrawingNotes.BendNotes oNote.Delete() Next Next
Büküm notu eklemek için bu komutu kullanıyoruz
Dim oDoc As DrawingDocument Dim oSheet As Sheet Dim oView As DrawingView Dim oCurve As DrawingCurve Dim oBendNote As BendNote oDoc = ThisApplication.ActiveDocument oSheet = oDoc.ActiveSheet For Each oView In oSheet.DrawingViews For Each oCurve In oView.DrawingCurves If oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendDownEdge _ Or oCurve.EdgeType = Inventor.DrawingEdgeTypeEnum.kBendUpEdge Then ' Create the bend note oBendNote = oSheet.DrawingNotes.BendNotes.Add(oCurve) End If Next 'oCurve Next 'oView
Büküm notuna yazı eklemek içinde bu komutu kullanıyoruz
Sub Main 'get drawing document you want to target oDDoc = ThisDrawing.Document 'specify what text to add after angle in different situations 'we will use this later in the code oMap = ThisApplication.TransientObjects.CreateNameValueMap oMap.Add("<90", " (AÇIK) ") 'angle is less than 90 oMap.Add(">90", " (KAPALI) ") 'angle is greater than 90 For Each oSheet As Sheet In oDDoc.Sheets 'if no bend notes on sheet, skip to next sheet If oSheet.DrawingNotes.BendNotes.Count = 0 Then Continue For oBNotes = oSheet.DrawingNotes.BendNotes For Each oBNote As BendNote In oBNotes oFBN = oBNote.FormattedBendNote 'if this bend note does not contain any angle info, skip to next bend note If Not oFBN.Contains("<BendAngle") Then Continue For 'create a variable to hold the text we will be adding after the angle Dim oTextToAdd As String = vbNullString 'isolate and get the angle part of the text oParts = oBNote.Text.Split(" ") 'split into multiple sub-strings, by where spaces are Dim oAngle As String = vbNullString For Each oPart In oParts If oPart.Contains("°") Then 'if it contains the 'degree' mark oAngle = oPart End If Next 'check to make sure we found the angle text If String.IsNullOrEmpty(oAngle) Then Continue For 'could not isolate the angle text 'check angle (extract numerical value from String, then compare) If Val(oAngle) < 90 Then oTextToAdd = oMap.Value("<90") 'uses the Value of that place in the oMap ElseIf Val(oAngle) > 90 Then oTextToAdd = oMap.Value(">90") 'uses the Value of that place in the oMap End If 'use our custom Function's below oFBN = FixBendAngle(oFBN, oTextToAdd) oFBN = FixRadius(oFBN) 'now finally set the new value oBNote.FormattedBendNote = oFBN Next Next End Sub Function FixBendAngle(oFormattedBendNote As String, oTextToPutAfterAngle As String) As String 'get BendAngle part of formatted text oPos1 = oFormattedBendNote.IndexOf("<BendAngle") oPos2 = oFormattedBendNote.IndexOf("</BendAngle>") + Len("</BendAngle>") oLen = oPos2 - oPos1 oSubSt = oFormattedBendNote.Substring(oPos1, oLen) 'MsgBox("oSubSt = " & oSubSt, , "") oResult = oFormattedBendNote.Replace(oSubSt, "<BendAngle> </BendAngle>" & oTextToPutAfterAngle) Return oResult End Function Function FixRadius(oFormattedBendNote As String) As String 'get Radius part of formatted text oPos1 = oFormattedBendNote.IndexOf("<BendRadius") oPos2 = oFormattedBendNote.IndexOf("</BendRadius>") + Len("</BendRadius>") oLen = oPos2 - oPos1 oSubSt = oFormattedBendNote.Substring(oPos1, oLen) 'MsgBox("oSubSt = " & oSubSt, , "") oResult = oFormattedBendNote.Replace(oSubSt, "<BendRadius> </BendRadius>") Return oResult End Function
Büküm çizgisini gizlemek içinde bu komutu kullanıyoruz
'This assumes the drawing is active and the first view on first sheet 'contains flat pattern Dim drawing As DrawingDocument = ThisDoc.Document Dim flatPatternView As DrawingView = drawing.Sheets(1).DrawingViews(1) Dim part As PartDocument = flatPatternView.ReferencedDocumentDescriptor.ReferencedDocument Dim sheetMetalDef As SheetMetalComponentDefinition = part.ComponentDefinition Dim flatPattern As FlatPattern = sheetMetalDef.FlatPattern For Each flatBendResult As FlatBendResult In flatPattern.FlatBendResults Dim edge As Edge = FlatBendResult.Edge Dim innerRadius As Double = FlatBendResult.InnerRadius If innerRadius > 1 Then '[cm] Dim edgeDrawingCurves As DrawingCurvesEnumerator = flatPatternView.DrawingCurves(edge) For Each edgeDrawingCurve As DrawingCurve In edgeDrawingCurves For Each segment As DrawingCurveSegment In edgeDrawingCurve.Segments 'TODO: Do something useful with drawing curve segment which belongs to bend grater then 1 [cm] segment.Visible = False Next Next End If Next
Lakin radius 10 dan büyükse büküm notunu sil yada ekleme gibi bir düzenleme yapamıyoruz. Bu konuda geri dönüş beklemekteyim.
@Alpergk35 , konu başlığı daha anlaşılır olması için @Olcay.Kuk tarafından düzenlendi. Önceki başlık "Bend Notu Ekleme Ve Silme Kodu"
Çözüldü! Çözüme gidin.