Add border from a rule

Add border from a rule

Anonymous
Not applicable
630 Views
2 Replies
Message 1 of 3

Add border from a rule

Anonymous
Not applicable
Good morning,

I have a problem with this code,
I need to change the border of a drawing with a border that I have on my desktop, but it doesn't works
I will be grateful with the help

Sub
Main() Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument Dim oSheet As Sheet = oDrawDoc.ActiveSheet Dim oBorder As Border = oSheet.Border DeleteBorders InsertBorder End Sub Sub DeleteBorders() Dim oDrawDoc1 As DrawingDocument = ThisApplication.ActiveDocument Dim oSheet1 As Sheet = oDrawDoc1.ActiveSheet For Each oSheet1 In ThisApplication.ActiveDocument.Sheets If Not oSheet1.Border Is Nothing Then oSheet1.Border.Delete End If Next End Sub Sub InsertBorder() Dim oDrawDoc3 As DrawingDocument = ThisApplication.ActiveDocument Dim oSheet3 As Sheet = oDrawDoc3.ActiveSheet Dim borderDef As BorderDefinition strBorderRequired = True Dim strDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument ThisDrawing.ResourceFileName = "C:\Users\Desktop\Codigos\Templates\Parts.idw" Dim SourceFile = ThisDrawing.ResourceFileName Dim strSourceIDW As DrawingDocument strSourceIDW = ThisApplication.Documents.Open(SourceFile, False) For Each borderDef In strSourceIDW.BorderDefinitions If (StrComp(borderDef.Name, vbTextCompare) = 0) Then CopyFrom = borderDef.CopyTo(strDrawDoc, True) End If Next strSourceIDW.Close() Dim oNewBorderDef As BorderDefinition oNewBorderDef = oDrawDoc3.BorderDefinitions.Item(borderDef.Name) For Each oSheet3 In oDrawDoc3.Sheets oSheet3.AddBorder(oNewBorderDef) Next MessageBox.Show("The border was changed", "Title") End Sub
0 Likes
Accepted solutions (1)
631 Views
2 Replies
Replies (2)
Message 2 of 3

SBix26
Consultant
Consultant

There's a forum specifically for questions about customizing Inventor (programming): Inventor Customization Forum.


Sam B
Inventor Pro 2022.0.1 | Windows 10 Home 20H2
LinkedIn

Message 3 of 3

Curtis_Waguespack
Consultant
Consultant
Accepted solution