Author Topic: Add/Remove Style Overrides with VBA  (Read 2929 times)

0 Members and 1 Guest are viewing this topic.

Guest

  • Guest
Add/Remove Style Overrides with VBA
« on: March 18, 2008, 04:42:27 PM »
I'm trying to update some older ABS/MEP drawings to a new office standard and was hoping to do a lot of the updating auto-magically using VBA..... BUT.... I can't seem to figure out how to access the information to apply or remove an override to a particular system.  I'm guess the extension dictionary plays a part in this but I don't have much experience with that so I'm reaching out for help.  Can anyone point me in the right direction?

I would think that walls, doors and windows would basically be the same thing (just different names) so if you've got any snippets on how to change AEC objects, I'd like to see them if you're willing to share.

Below is what I've got so far.

Code: [Select]
Public Sub PipeSystemDefinitions()
    Dim oPlumbingSysDef As AecbPlumbingSystemDef
    Dim oPlumbingSysDefs As AecbPlumbingSystemDefs
    Dim oDB As New AecbPlumbingDatabase
    Dim oDictionary As AcadDictionary
   
    oDB.Init ThisDrawing.Database
    Set oPlumbingSysDefs = oDB.PlumbingSystemDefs
   
    For Each oPlumbingSysDef In oPlumbingSysDefs
        If oPlumbingSysDef.Name <> "Standard" Then
            Debug.Print oPlumbingSysDef.Name
            Set oDictionary = oPlumbingSysDef.GetExtensionDictionary
        End If
    Next oPlumbingSysDef
End Sub

Bob Wahr

  • Guest
Re: Add/Remove Style Overrides with VBA
« Reply #1 on: March 18, 2008, 05:01:14 PM »
Ben doesn't come around here much anymore but I'll ping him and see if he'll take a look at this thread if nobody else chimes in.  Pretty sure he's done some similar stuff.

Guest

  • Guest
Re: Add/Remove Style Overrides with VBA
« Reply #2 on: March 18, 2008, 08:28:26 PM »
*looks around*

Ben who??!?   :?

Bob Wahr

  • Guest
Re: Add/Remove Style Overrides with VBA
« Reply #3 on: March 18, 2008, 09:06:01 PM »
Ben aka Bashworth aka CSO aka CorpSellOut.  I pointed him at the thread which is about all the most I can do.  I know he's done some struggling with ADT objects.

Guest

  • Guest
Re: Add/Remove Style Overrides with VBA
« Reply #4 on: March 18, 2008, 09:08:20 PM »
Thanks!

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Add/Remove Style Overrides with VBA
« Reply #5 on: March 19, 2008, 11:50:30 AM »
Matt,

We use ADT, now AutoCAD Architecture.  Do you guys use Project Navigator?  It has a nifty project standards feature that will update styles throughout the project.

If not, you can change stuff programatically - even ObjectDBX.  Note the following:

Code: [Select]
(setq wallobj(vlax-ename->vla-object(car(entsel))))
(setq  wallstyle(vlax-get wallobj 'style))

(vlax-dump-Object wallobj t)
(vlax-dump-Object wallstyle)

(vlax-put wallobj 'stylename "MyStyle")

You just have to know each collections supported methods . . ..

oops - I just posted VLISP code in a VBA forum - sorry.  (lisp is better anyway  :lmao: :ugly:)
James Buzbee
Windows 8

Guest

  • Guest
Re: Add/Remove Style Overrides with VBA
« Reply #6 on: March 19, 2008, 03:55:53 PM »
Matt,

We use ADT, now AutoCAD Architecture.  Do you guys use Project Navigator?  It has a nifty project standards feature that will update styles throughout the project.

If not, you can change stuff programatically - even ObjectDBX.  Note the following:

Code: [Select]
(setq wallobj(vlax-ename->vla-object(car(entsel))))
(setq  wallstyle(vlax-get wallobj 'style))

(vlax-dump-Object wallobj t)
(vlax-dump-Object wallstyle)

(vlax-put wallobj 'stylename "MyStyle")

You just have to know each collections supported methods . . ..

oops - I just posted VLISP code in a VBA forum - sorry.  (lisp is better anyway  :lmao: :ugly:)

We don't use the Project Navigator.  We only use Sheet Set Manager for plotting our drawings.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Add/Remove Style Overrides with VBA
« Reply #7 on: March 19, 2008, 05:28:15 PM »
Dude - the Project Navigator is god.  It is AutoDesk's single best invention since the mirrtext sysvar!  :lmao:

I would strongly suggest you invest a little time to see what it can do.  If you  have any questions just ask and I'll try to answer . . ..
James Buzbee
Windows 8