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

I need a lisp routine to change the abbreviations in drawing settings

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Shubz26
797 Views, 2 Replies

I need a lisp routine to change the abbreviations in drawing settings

Shubz26
Enthusiast
Enthusiast

I need a lisp routine to change the abbreviations in drawing settings. Anyone have one, or any guidance on how I can create one. I've never written a lisp before, I tried now but couldn't even get mine to run the EDITDRAWINGSETTINGS command.

 

image.png

Civil 3D 2020
Intel Xeon CPU W3550 @ 3.07GHz
Nvidia Quadro 2000
25GB RAM
Windows 7 Enterprise 64 Bit
0 Likes

I need a lisp routine to change the abbreviations in drawing settings

I need a lisp routine to change the abbreviations in drawing settings. Anyone have one, or any guidance on how I can create one. I've never written a lisp before, I tried now but couldn't even get mine to run the EDITDRAWINGSETTINGS command.

 

image.png

Civil 3D 2020
Intel Xeon CPU W3550 @ 3.07GHz
Nvidia Quadro 2000
25GB RAM
Windows 7 Enterprise 64 Bit
2 REPLIES 2
Message 2 of 3
hippe013
in reply to: Shubz26

hippe013
Advisor
Advisor
Accepted solution

The following should help you get going. It demonstrates how to drill down to the abbreviation settings and how to set the values. I'll leave the rest up to you. 

(defun c:test ()
  (setq ad (_GetAeccDocument)) ;Get the Aecc Document
  (setq s (vlax-get-property ad 'Settings)) ;Get the aecc settings from the Aecc Document
  (setq ds (vlax-get-property s 'DrawingSettings)) ;Get the Drawing Settings from the aecc settings
  (setq as (vlax-get-property ds 'AbbreviationSettings)) ;Get the abbreviation settings from the drawing settings
  (setq alignAbbrev (vlax-get-property as 'AlignmentAbbreviations)) ;Get the Alignment abbreviations from the abbreviation settings
  (setq alignBeg (vlax-get-property alignAbbrev 'AlignmentBeginning)) ;Get the alignment beginning abbreviation from the alignment abbreviations
  (princ (strcat "\nCurrent AlignmentBeginning Abbreviation: " alignBeg)) ;Print the current value of the alignment beginning abbreviation 
  (vlax-put-property alignAbbrev 'AlignmentBeginning "BEG") ;Set the value of the Alignment Beginning abbreviation
  (princ (strcat "\nNew AlignmentBeginning Abbreviation: " (vlax-get-property alignAbbrev 'AlignmentBeginning))) ;Print the new value of the alignment beginning abbreviation
  (princ) ;exit clean
  )

(defun _GetAeccDocument ()
  (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 (vlax-get-acad-object) (strcat "AeccXUiLand.AeccApplication." C3D)))
  (vlax-get-property C3D 'ActiveDocument)
  )

The following should help you get going. It demonstrates how to drill down to the abbreviation settings and how to set the values. I'll leave the rest up to you. 

(defun c:test ()
  (setq ad (_GetAeccDocument)) ;Get the Aecc Document
  (setq s (vlax-get-property ad 'Settings)) ;Get the aecc settings from the Aecc Document
  (setq ds (vlax-get-property s 'DrawingSettings)) ;Get the Drawing Settings from the aecc settings
  (setq as (vlax-get-property ds 'AbbreviationSettings)) ;Get the abbreviation settings from the drawing settings
  (setq alignAbbrev (vlax-get-property as 'AlignmentAbbreviations)) ;Get the Alignment abbreviations from the abbreviation settings
  (setq alignBeg (vlax-get-property alignAbbrev 'AlignmentBeginning)) ;Get the alignment beginning abbreviation from the alignment abbreviations
  (princ (strcat "\nCurrent AlignmentBeginning Abbreviation: " alignBeg)) ;Print the current value of the alignment beginning abbreviation 
  (vlax-put-property alignAbbrev 'AlignmentBeginning "BEG") ;Set the value of the Alignment Beginning abbreviation
  (princ (strcat "\nNew AlignmentBeginning Abbreviation: " (vlax-get-property alignAbbrev 'AlignmentBeginning))) ;Print the new value of the alignment beginning abbreviation
  (princ) ;exit clean
  )

(defun _GetAeccDocument ()
  (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 (vlax-get-acad-object) (strcat "AeccXUiLand.AeccApplication." C3D)))
  (vlax-get-property C3D 'ActiveDocument)
  )
Message 3 of 3
Shubz26
in reply to: hippe013

Shubz26
Enthusiast
Enthusiast

Thanks a million for this!

It took a while to figure out, but I managed to get it to change all the abbreviations I needed to. 

Civil 3D 2020
Intel Xeon CPU W3550 @ 3.07GHz
Nvidia Quadro 2000
25GB RAM
Windows 7 Enterprise 64 Bit
0 Likes

Thanks a million for this!

It took a while to figure out, but I managed to get it to change all the abbreviations I needed to. 

Civil 3D 2020
Intel Xeon CPU W3550 @ 3.07GHz
Nvidia Quadro 2000
25GB RAM
Windows 7 Enterprise 64 Bit

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

Post to forums  

Rail Community


Autodesk Design & Make Report