Thursday, 6 April 2017

Break all cross-part sketch projections

Short and sweet: How to Break Link on cross-part projections for all occurrences in an assembly.




I have mine disabled and I don't create cross-part references. that will slow inventor to a halt, especially on large assemblies.

When you change to Modeling View inside assembly you can select and delete more than one links at a time but only if they are part of the same sketch

Here is the ilogic code used to break adaptivity. Please run this code from an Assembly, internal or external rule

----------------------------------
Dim oAsmDoc As Document 
oAsmDoc = ThisApplication.ActiveDocument

If oAsmDoc.DocumentType <> kAssemblyDocumentObject Then
    MessageBox.Show("Run this rule from an assembly!", "iLogic")
    Return
End If

i=0

For Each oDoc As Document In oAsmDoc.AllReferencedDocuments
 Try 
  If oDoc.ModelingSettings.AdaptivelyUsedInAssembly = True Then
   oDoc.ModelingSettings.AdaptivelyUsedInAssembly = False
   i += 1
  End If
 Catch
 End Try
Next

MessageBox.Show("Turned off adaptivity for " & i & " documents!", "iLogic")
----------------------------------
Please see the screencast example here:
Thanks.
ADS


photo credit: Chatsy POP.H chain (license)

Monday, 3 April 2017

Drawing Resource Transfer Wizard 2017 - Incorrect Font

Short and sweet again. No time for prelude.



If you use Drawing Resource Transfer Wizard 2017 to update title blocks for multiple drawings, text fonts would be changed incorrectly.

It is a known issue in 2017 and on Release 3 Update 1 still not working. 

Release 4 is around the corner (April release) and I was told it's fixed but till then or if we have a regression and this bug returns here is an ilogic code to automate this.

The Knowledge Base Article recommends updating manually each drawing ....hmmm... we can do better:

-------------------------------------------
Dim oDestinationDocument As DrawingDocument
oDestinationDocument = ThisApplication.ActiveDocument

Dim oSourceDocument As DrawingDocument
oSourceDocument = ThisApplication.Documents.Open("D:\ADS\CAD\TEMPLATE.idw")
 
' Get the new source title block definition.
Dim oSourceTitleBlockDef As TitleBlockDefinition
 
oSourceTitleBlockDef = oSourceDocument.TitleBlockDefinitions.Item("TITLEBLOCK_NAME")
 
' Get the new title block definition.
Dim oNewTitleBlockDef As TitleBlockDefinition
oNewTitleBlockDef = oSourceTitleBlockDef.CopyTo(oDestinationDocument,True)'true to replace existing
 
' Iterate through the sheets, replace tibleblock with the one newly added.
Dim oSheet As Sheet
For Each oSheet In oDestinationDocument.Sheets
 oSheet.Activate
 
 oSheet.TitleBlock.Delete
 Call oSheet.AddTitleBlock(oNewTitleBlockDef)
Next
-------------------------------------------
Use code Injector from here:
to update multiple files at once. There is no point to run it from the assembly (not in my case) because not all files are part of the same assembly.
Later
ADS
photo credit: PeterThoeny Space and time warp (license)