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: 

Edit Point Style in Bulk

22 REPLIES 22
SOLVED
Reply
Message 1 of 23
bnesja
1817 Views, 22 Replies

Edit Point Style in Bulk

Is there a command or LISP out there to change Point Style Properties in bulk? The company I work for has been given standard templates to work from (from our state's DOT) but there are things I would like to change in nearly all of the point styles. I would like all of them to be set to "Use Drawing Scale" - .12inches for size and would prefer to have both Marker and Label set to "0" layer under Display. With hundreds of point styles to modify, I was kind of hoping there was an easier way than one by one.

Tags (1)
22 REPLIES 22
Message 2 of 23
BrianHailey
in reply to: bnesja

There are some things you can do for label styles but, none that I'm aware of for object styles. Perhaps someone has some custom programing skills that would do it.

Brian J. Hailey, P.E.



GEI Consultants
My Civil 3D Blog

Message 3 of 23
bnesja
in reply to: BrianHailey

I was hoping not but figured it would require a custom utility of some sort. Smiley Sad

Thank you for your input.

Message 4 of 23
odoshi
in reply to: bnesja

I've writtin a few routines that would set defaults and rename styles. Some companies like to prefix all style names with their initials so users know which styles are "safe" to use. But other options can be set as well.

 

Regards,

Mike

 

Mike Caruso
Autodesk Certified Instructor 2014
AutoCAD/Civil 3D Autodesk Certified Professional 2014, 2015, 2018
www.whitemountaincad.com
Message 5 of 23
Jeff_M
in reply to: bnesja

Here's a quick little lisp that sets the 4 properties as you wanted. 

;|Command to globally change the MarkerSizeType, MarkerSize, MarkerDisplay Layer,
   and LabelDIsplay Layerproperties to be used for all point styles.
   Created 8/4/2014 by Jeff Mishler of Quux Software
|;
(defun c:ResetPointStyles
       (/ *acad* c3d c3ddoc enum prod prodstr siztyp)
  (vl-load-com)
  (setq prod (vlax-product-key))
  (setq	prodStr	(strcat	"AeccXUiLand.AeccApplication"
			(cond ((vl-string-search "\\R17.0\\" prod)
			       ".4.0"
			      )
			      ;;2007
			      ((vl-string-search "\\R17.1\\" prod)
			       ".5.0"
			      )
			      ;;2008
			      ((vl-string-search "\\R17.2\\" prod)
			       ".6.0"
			      )
			      ;;2009
			      ((vl-string-search "\\R18.0\\" prod)
			       ".7.0"
			      )
			      ;;2010
			      ((vl-string-search "\\R18.1\\" prod)
			       ".8.0"
			      )
			      ;;2011
			      ((vl-string-search "\\R18.2\\" prod)
			       ".9.0"
			      )
			      ;;2012
			      ((vl-string-search "\\R19.0\\" prod)
			       ".10.0"
			      )
			      ;;2013
			      ((vl-string-search "\\R19.1\\" prod)
			       ".10.3"
			      )
			      ;;2014
			      ((vl-string-search "\\R20.0\\" prod)
			       ".10.4"
			      )
			      ;;2015
			      (t "")
			)
		)
  )
  (and (setq *acad* (vlax-get-acad-object))
       (setq C3D (vla-getinterfaceobject *acad* prodStr))
       (setq C3Ddoc (vla-get-activedocument C3D))
  )
  
    (progn
        (vlax-for styl (vlax-get c3ddoc 'PointStyles)
	  (vlax-put styl 'markersizetype 0)
	  (vlax-put styl 'markersize (/ 0.12 12))
	  (vlax-put-property (vlax-get styl 'labeldisplaystyleplan) 'layer "0")
	  (vlax-put-property (vlax-get styl 'markerdisplaystyleplan) 'layer "0")
      )
      (princ "\nAll point styles updated!")
    )  
  (princ)
)

 

Jeff_M, also a frequent Swamper
EESignature
Message 6 of 23
bnesja
in reply to: Jeff_M

You, Sir, are a life saver! Thank you.

Message 7 of 23
tcorey
in reply to: Jeff_M

Jeff, I was going to attempt this today, but mine would have been fifty lines longer and would have taken me two hours. You probably did it in a ten minutes.

 

I wasn't aware of vlax-put, just vlax-put-property. How do you tell which to use?

 

Lastly, a comment. This thread illustrates why I wish Autodesk would support vlisp for Civil 3D more. It makes it so easy for casual programmers (like me) to access Civil 3D objects.

 

Tim



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 8 of 23
Jeff_M
in reply to: tcorey


@tcorey wrote:

I wasn't aware of vlax-put, just vlax-put-property. How do you tell which to use?

 

Tim


Good question, Tim. I will always attempt to use vlax-get, vlax-put, & vlax-invoke before using the longer winded versions. Two reasons for that, one, I'm lazy when it comes to typing, so the less I need to type, the happier I am.The second is related to the first, in that the short versions do not need variants, arrays and such...you can get & pass plain lists (when a list of items is used). 

 

The problem is, not all objects support the short versions. One Autocad specific instance is the GetBoundingBox method of the Acad Entity object. It requires you to use either vla-getboundingbox ent or vlax-invoke-method ent 'getboundingbox and convert the safearrays returned to usable lists. So what I do is test the short version, if I get an error (method not found/supported, etc.) I use the long version.

 

There is a much better description of how this all works somewhere out there (perhaps in the Visual Lisp Developer's Bible by David Stein).

Jeff_M, also a frequent Swamper
EESignature
Message 9 of 23
jmayo-EE
in reply to: Jeff_M

...The man, the myth, the legend...the all around nice guy. 🙂

John Mayo

EESignature

Message 10 of 23
tcorey
in reply to: Jeff_M

Thanks, Jeff.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 11 of 23
claimed4all
in reply to: Jeff_M

I was looking at this lisp at it is almost perfect for what I need.  I am looking for a routine to set the Marker and Label to Layer zero, but leave the point marker size unchanged.  I tried to remove those line items, but I am returned with a 'Message: Automation Error. Problem in loading application'.  How would I go about removing the marker size change options correctly?

Message 12 of 23
tcorey
in reply to: claimed4all

The automation error is usually a version issue.  You will need to modify the code for newer versions. I will take a look tomorrow if someone else hasn't fixed it for you by then. 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Gold Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 13 of 23
Jeff_M
in reply to: claimed4all

Here's an updated version, with the 2 lines commented out already, which should work in any version of C3D.

 

;|Command to globally change the MarkerSizeType, MarkerSize, MarkerDisplay Layer,
and LabelDisplay Layerproperties to be used for all point styles.
Created 8/4/2014 by Jeff Mishler of Quux Software, modified to support any C3D version 7/27/16
|;
(defun c:ResetPointStyles
(/ *acad* c3d c3ddoc enum prod prodstr siztyp acApp)
(vl-load-com)
(setq acApp (vlax-get-acad-object))
(setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
(if vlax-user-product-key
(vlax-user-product-key)
(vlax-product-key)
)
)
C3D (vl-registry-read C3D "Release")
C3D (substr
C3D
1
(vl-string-search "." C3D (+ (vl-string-search "." C3D) 1))
)
C3D (vla-getinterfaceobject
acApp
(strcat "AeccXUiLand.AeccApplication." C3D)
)
)
(setq c3ddoc (vlax-get C3D 'activedocument))
(progn
(vlax-for styl (vlax-get c3ddoc 'PointStyles)
;(vlax-put styl 'markersizetype 0)
;(vlax-put styl 'markersize (/ 0.12 12))
(vlax-put-property
(vlax-get styl 'labeldisplaystyleplan)
'layer
"0"
)
(vlax-put-property
(vlax-get styl 'markerdisplaystyleplan)
'layer
"0"
)
)
(princ "\nAll point styles updated!")
)
(princ)
)
Jeff_M, also a frequent Swamper
EESignature
Message 14 of 23
claimed4all
in reply to: Jeff_M

I played with this routine a bit.  Looking to change all my Point Styles to change size to 'USE FIXED SCALE' with values of '30,30,1'

 

I guessed what values to change, ran the routine, is say ran successfully but nothing changed.

 

 

We typically have a Use Drawing scale.  But when survey completes their drawings at 30 scale, I engineer at 20, and then do details at 10, it makes these symbols very wonky.  I would rather just set to 30 in these situations and call it good.

Message 15 of 23
Jeff_M
in reply to: claimed4all

OK, so what did you change? If you used the second version posted and edited that, did you uncomment the two lines affecting the marker size?
Jeff_M, also a frequent Swamper
EESignature
Message 16 of 23
claimed4all
in reply to: Jeff_M

I don't edit these lisp routines very often, but my best guess was to change to lines that are

 

;(vlax-put styl 'markersizetype 0)
;(vlax-put styl 'markersize (/ 0.12 12))

 

TO

 

;(vlax-put styl 'markersizetype 1)
;(vlax-put styl 'markersize (30 30 1))

 

 

But it appears that's not correct. I will continue to play with this for future use.  As I only have about 50 styles to change, which goes pretty quick.

Message 17 of 23
Jeff_M
in reply to: claimed4all

Try changing to this:

(vlax-put styl 'markersizetype 3)
(vlax-put styl 'markerfixedscale '(30 30 1))
 
Jeff_M, also a frequent Swamper
EESignature
Message 18 of 23
claimed4all
in reply to: Jeff_M

No luck there.  I tried a 1, 2, 3, 4 in the marker size type field.  No luck.

 

The command is correcting the layers, which is awesome.  I can not get it to change the point scale.

 

Even with your original revised code showing

 

;(vlax-put styl 'markersizetype 0)
;(vlax-put styl 'markersize (/ 0.12 12))

 

The LISP does not change the point marker size.  So I could have a code error from someplace else.

Message 19 of 23
Jeff_M
in reply to: bnesja

You have not uncomment ed those two lines...remove the semicolons.
Jeff_M, also a frequent Swamper
EESignature
Message 20 of 23
Jeff_M
in reply to: Jeff_M

Oh, and you must use doubles, not integers:

(vlax-put styl 'markersizetype 3)
(vlax-put styl 'markerfixedscale '(30.0 30.0 1.0))

This works.
Jeff_M, also a frequent Swamper
EESignature

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

Post to forums  

Rail Community


Autodesk Design & Make Report