Inventor Customization

Reply
Distinguished Contributor
Rene-J
Posts: 305
Registered: ‎05-07-2005
Message 1 of 6 (398 Views)

Replace styles in Drawing

398 Views, 5 Replies
08-24-2012 02:52 AM

Hi

I have some styles I will like to replace in some drawings

but how? I cant find any function to do this.

Do I missing some thing ?

 

Dim oIDWStyles As Inventor.DrawingStylesManager
 Set oIDWStyles = oDrawDoc.StylesManager
 Dim oldstyle As style
 Dim Newstyle As style
   For Each oldstyle In oIDWStyles.Styles
     If oldstyle.Name = "Old style" Then
       '  Debug.Print oldstyle.Name & " : " & oldstyle.InternalName
        For Each Newstyle In oIDWStyles.Styles
          If Newstyle.Name = "New style" Then
            'Debug.Print Newstyle.Name & " : " & Newstyle.InternalName
            End If
        Next
        'How to replace oldstyle with newstyle
         'oldstyle = Newstyle
       
     End If
   Next

 

René J

Contributor
cmines
Posts: 21
Registered: ‎06-08-2012
Message 2 of 6 (390 Views)

Re: Replace styles in Drawing

08-24-2012 05:31 AM in reply to: Rene-J

This worked for me:

 

' Create the parts list and set a reference to it.
    Dim oPartsList As PartsList
   
    Set oPartsList = oSheet.PartsLists.Add(oDrawingView1, oPlacementPoint)
    oPartsList.Style = oDrawDoc.StylesManager.PartsListStyles.Item("PARTS LIST PART")

 

Hope this helps.

Chris

*Expert Elite*
jdkriek
Posts: 528
Registered: ‎03-29-2007
Message 3 of 6 (388 Views)

Re: Replace styles in Drawing

08-24-2012 05:43 AM in reply to: Rene-J

You can rename it, delete it, set another style as the object default, but no direct replace that I know of.

 

If you set the new styles as object defaults, then you could change all elements to the active standard.

Jonathan D. Kriek

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below
Contributor
cmines
Posts: 21
Registered: ‎06-08-2012
Message 4 of 6 (381 Views)

Re: Replace styles in Drawing

08-24-2012 05:57 AM in reply to: jdkriek

UGHHHH....I swear I read "parts list style" the first time I read your post!  Thats what I get for responding before I've had some caffeine!

 

*Expert Elite*
jdkriek
Posts: 528
Registered: ‎03-29-2007
Message 5 of 6 (379 Views)

Re: Replace styles in Drawing

08-24-2012 06:04 AM in reply to: cmines

Get some coffee, it will be alright - for a Friday :smileywink:

Jonathan D. Kriek

Autodesk Inventor Certified Expert
Microsoft Certified Application Developer
_____________________________________________________
Did I help you? Please choose Accept as Solution or Kudos below
Distinguished Contributor
Rene-J
Posts: 305
Registered: ‎05-07-2005
Message 6 of 6 (348 Views)

Re: Replace styles in Drawing

09-05-2012 08:59 AM in reply to: jdkriek

Thanks Jonathan

Finally I got the time, to look at your suggestion.

I'm sorry I have not commented earlier, I've been on vacation.

I thought there was an easier solution.

René J

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube