Force Object to Adhere to Style

Force Object to Adhere to Style

MechMachineMan
Advisor Advisor
412 Views
5 Replies
Message 1 of 6

Force Object to Adhere to Style

MechMachineMan
Advisor
Advisor

I've noticed that objects placed with a certain style stay active with that style even if the style gets replaced in the library.

 

There is currently no way that I have found to force it to adhere to the non-cached version of the style unless you switch it to a different style and then back.

 

This seems like a lot of extra work and is not very practical in programming it. It would be nice to have a method to remove the overrides to the object and force it to adhere to the new style (essentially doing the same thing as swapping it do a different style and then back, or deleting and replacing the object).

 

 

Steps to reproduce:

1. Place object with a style

2. Revise style of same name in a different file.

3. Copy the style over to the first document.

4. Notice how the object hasn't changed.

5. Swap the object off of that style, and then back to the style of the same name.

6. Notice it now adheres to the new style version.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
413 Views
5 Replies
Replies (5)
Message 2 of 6

smilinger
Advisor
Advisor

Not sure what kind of style are you talking about, when implementing new inventor templates I always struggle with textboxes in drawing title block, this is what I use to get rid of all the style overrides, hope it can help you.

 

Imports System.Text.RegularExpressions

Dim doc As DrawingDocument = ThisDoc.Document
Dim sketch As DrawingSketch
doc.TitleBlockDefinitions(1).Edit(sketch)

For Each txtbox As Inventor.TextBox In sketch.TextBoxes
	txtbox.FormattedText = Regex.Replace(txtbox.FormattedText, "</?StyleOverride[^>]*>", "")
Next

doc.TitleBlockDefinitions(1).ExitEdit(True)
0 Likes
Message 3 of 6

MechMachineMan
Advisor
Advisor

Thanks!

 

Forgot to mention - it's for revision table and partslist styles.


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 4 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @MechMachineMan,

 

 

To understand more about the issue, Can you please provide a screen shots or video recording?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 5 of 6

Frederick_Law
Mentor
Mentor


That what I am planning to do.  A program to compare and replace style.

Lots of old files with styles used from different standards.  Drawing file from different users in company will have collection of title blocks, symbol, color, text, layer all over the place.

 

Problem is, its difficult to "map" styles.

For example. layers.

We don't use same layer name.  Its difficult for program to know if layer "Red" is for dimensions or notes.

Lots of user interaction is required.

 

Replacing style require replacing Standard used in the object first then a style in that standard.

The program may prompt user to pick the new style and remember that "mapping" for the future.

 

A simple program can be made to replace the style depends on the object to a default style in the current standard.

This can be use to clean up files so they use style from only one standard.

0 Likes
Message 6 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@MechMachineMan,

 

For more clarity, is the style updated from library to local?

 

There are 2 places to store - local(document) and global (Library). When user change a style, they should also sync it to another location. "PartsListStyle.UpdateFromGlobal" API can be used after changing the library. So that local (in document) style can be synced from the one in library.

 

Thanks and regards,

 

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes