iLogic Break ole link, not delete

iLogic Break ole link, not delete

Jelvin_
Advocate Advocate
1,071 Views
3 Replies
Message 1 of 4

iLogic Break ole link, not delete

Jelvin_
Advocate
Advocate

Hi.

 

I want to run an iLogic rule which breaks my resolved OLE links ( I've found about 30 examples which deletes the ole links but none that actually breaks the link and keeps/embeds the file. Is it possible, i only found the way to read the document type, not change it.

 

 Dim oDoc As Inventor.Document
 Dim ref As Inventor.ReferencedOLEFileDescriptor
 oDoc = ThisApplication.ActiveDocument
 For Each ref In oDoc.ReferencedOLEFileDescriptors
   ref.BREAK THIS LINK
 Next

 

0 Likes
Accepted solutions (3)
1,072 Views
3 Replies
Replies (3)
Message 2 of 4

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Does this help?

 Dim oDoc As Inventor.Document
 Dim ref As Inventor.ReferencedOLEFileDescriptor
 oDoc = ThisApplication.ActiveDocument

     Dim objReferenceOLE As ReferencedOLEFileDescriptor
     'objReferenceOLE = oDoc.ReferencedOLEFileDescriptors.Add(CompleteSendPathPartlistXls, kOLEDocumentUnknownObject)

 For Each ref In oDoc.ReferencedOLEFileDescriptors
	 
   objReferenceOLE = oDoc.ReferencedOLEFileDescriptors.Add(ref.FullFileName, kOLEDocumentUnknownObject)
   ref.Delete
 Next

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 4

Jelvin_
Advocate
Advocate
Accepted solution

This does crash Inventor each time i run it.

Maybe i need to clarify what i want to do.

 

In a drawing, in the title block, there is a ole link logo. I want this to be embedded.

I have a rule, that does not work for me in 2021.

 

But it would be great just to run the Break Link command instead of this

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim TitleLogo As String = "C:\WF\Designs\Logo.png"


For Each oSheet As Sheet In oDoc.Sheets
    Dim oTD As TitleBlockDefinition = oSheet.TitleBlock.Definition
    Dim oImages As SketchImages = oTD.Sketch.SketchImages
    For Each oImg As SketchImage In oImages
		
	If Not oImg.LinkedToFile Then Continue For
        Dim oFN As String = oImg.ReferencedFileDescriptor.FullFileName
        Dim oPos As Point2d = oImg.Position
'        Dim oTran As Boolean = oImg.Transparent
        Dim oWidth As Double = oImg.Width
        Dim oHeight As Double = oImg.Height
	
        oImg.Delete()
       Dim oNewImg As SketchImage = oImages.Add(TitleLogo, oPos, False) 'False = Not linked
'        oNewImg.Transparent = oTrans
       oNewImg.Width = oWidth
       oNewImg.Height = oHeight
       'Uncomment this line if the image moves after changing the width and height:
  '      oNewImg.Position = oPos
    Next
Next

 

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Jelvin_ 

I went through a similar scenario a couple years ago, and I don't believe there is a 'Break Link' command that is designed to work with a 'SketchImage' object.  There are 'Break Link' commands for other situations, but not this.  Basically the process within your last code, where you first capture the size and position of the existing one, then delete it, then put it back again without linking it, is the best process available right now, for that specific task.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)