Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Deleting unused styles en masse?

8 REPLIES 8
Reply
Message 1 of 9
deltacoolguy
945 Views, 8 Replies

Deleting unused styles en masse?

Is there a way to delete (purge) unused styles en masse via the command prompt?  Pipe network structure, pipe, and label styles primarily.  The purge command does not address these types of styles, as far as I can tell.

 

I know how to right-click, and hit "ok" to confirm one style at a time, but that takes time and is very tedious when you need to do dozens.  My company's template has oodles of styles that almost never get used, and I don't want to wade through all that stuff every time I use a pull-down menu.  I know how to get a style back in should I get too aggressive with my deletions, so that is not an issue.

 

Preferably I'd like to write a script so that I can do multiples deletions all at once and quickly.  I would save the script file and use it at the beginning of each new project, and modify it as necessary depending on what is likely to be used on a particular project.

 

I'm fairly decent at writing scripts for basic things like changing color, adding layers, and stuff like that.  But this I'm not sure about.  How do I know what to input for finding the style and ok'ing the deletion via a script?

 

Thanks.

Windows 10-64 Pro
8GB RAM (Home)
12GB RAM (Work)
AutoCAD Civil 3D 2019
8 REPLIES 8
Message 2 of 9
qnologi
in reply to: deltacoolguy
Message 3 of 9
deltacoolguy
in reply to: qnologi


@qnologi wrote:

Maybe this will assist...

 

https://knowledge.autodesk.com/support/autocad-civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2015/...


I found that when I did a search before I posted.  That outlines what I call the "long and slow" method.  It's not really efficient for doing dozens at one time.

Windows 10-64 Pro
8GB RAM (Home)
12GB RAM (Work)
AutoCAD Civil 3D 2019
Message 4 of 9
Jeff_M
in reply to: deltacoolguy


@deltacoolguy wrote:

 It's not really efficient for doing dozens at one time.


Really?

 

Command: _PurgeStyles
588 styles purged.

 

Granted, selecting individual styles is a pain with this command. That's why I prefer the one available in the Sincpac.

 

However, to just purge all unused styles, the one in C3D is pretty simple & quick.

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 9
deltacoolguy
in reply to: Jeff_M


@Jeff_M wrote:

@deltacoolguy wrote:

 It's not really efficient for doing dozens at one time.


Really?

 

Command: _PurgeStyles
588 styles purged.

 

Granted, selecting individual styles is a pain with this command. That's why I prefer the one available in the Sincpac.

 

However, to just purge all unused styles, the one in C3D is pretty simple & quick.


Ok, I was not aware of the PurgeStyles command specifically.  I was referring to the generic Purge command, which does not seem to address things like pipe network styles.  It does address things like dimension styles, text styles, etc.

 

Anyway, this is better.  Much better.  And thank you for that.

 

But, in an ideal world, I'd still like to be able to save and run a script, as I'd like to be able to surgically remove only certain styles.  But, I'm sensing that may be impossible, or at least more trouble than it's worth.

 

Windows 10-64 Pro
8GB RAM (Home)
12GB RAM (Work)
AutoCAD Civil 3D 2019
Message 6 of 9
qnologi
in reply to: deltacoolguy

Found this, perhaps someone could assist in making this work for your needs...

 

(defun c:foo ()
(repeat 4
(vl-cmdf "._AECCPURGESTYLES")
(while (eq (logand (getvar "cmdactive") 1) 1)
(command "_Y" "" "")
)
)
)

 

 
qnologi
Message 7 of 9
troma
in reply to: deltacoolguy


@deltacoolguy wrote:
....
I'd like to be able to surgically remove only certain styles.  But, I'm sensing that may be impossible, or at least more trouble than it's worth.

 

 

For a better purge command, with easier ways to deselect/select just the styles you want, please add your vote to this idea.


Mark Green

Working on Civil 3D in Canada

Message 8 of 9
DJGinAZ
in reply to: qnologi

I just commented out the defun and last paren and this solved my issue in my Batch Processing batch/script/lisp tool set for outgoing files. Thanks!

 

 


@qnologi wrote:

Found this, perhaps someone could assist in making this work for your needs...

 

(defun c:foo ()
(repeat 4
(vl-cmdf "._AECCPURGESTYLES")
(while (eq (logand (getvar "cmdactive") 1) 1)
(command "_Y" "" "")
)
)
)

 

 

 

Message 9 of 9
caddie99
in reply to: DJGinAZ

wblock

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report