Modify lsp to be used for all versions

Modify lsp to be used for all versions

mikemcculley5692
Enthusiast Enthusiast
612 Views
5 Replies
Message 1 of 6

Modify lsp to be used for all versions

mikemcculley5692
Enthusiast
Enthusiast

I have a lsp routine that was created by Jeff Mishler and modified by Ian McClain that I need to be able to use on C3D 2021 and above. I have no clue how to modify it to accept all versions.

 

Thanks,

Mike McCulley

 

;|Command to globally change the MarkerDisplay and MarkerLabel color to BYLAYER
to be used for all point styles.
Created 8/4/2014 by Jeff Mishler of Quux Software
Modified 6/5/2018 by Ian McClain of Stantec Consulting
|;
(defun c:PointLabelsBylayer
(/ *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-property (vlax-get styl 'markerdisplaystyleplan) 'color "BYLAYER")
(vlax-put-property (vlax-get styl 'labeldisplaystyleplan) 'color "BYLAYER")
(vlax-put-property (vlax-get styl 'markerdisplaystylemodel) 'color "BYLAYER")
(vlax-put-property (vlax-get styl 'labeldisplaystylemodel) 'color "BYLAYER")
(vlax-put-property (vlax-get styl 'markerdisplaystyleprofile) 'color "BYLAYER")
(vlax-put-property (vlax-get styl 'markerdisplaystylesection) 'color "BYLAYER")
)
(princ "\nAll point styles updated!")
)
(princ)
)

0 Likes
Accepted solutions (2)
613 Views
5 Replies
Replies (5)
Message 2 of 6

Jeff_M
Consultant
Consultant

Replace this:

(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))

 

with this:

  (defun getaeccApp (module / *acad* C3D) ;; module must be "Land", "Pipe", "Roadway", or "Survey"
  (vl-load-com)
  (if (and (setq *acad* (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
		       (vlax-get-acad-object)
		       (strcat "AeccXUi" module ".Aecc" (if (= (strcase module) "LAND") "" module) "Application." C3D)
		     )
	   )
      )
    C3D
  )
)
     (setq c3d (getaeccapp "Land"))

 

And it will work until Autodesk decides to change something that hasn't changed in 10+ years.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 6

mikemcculley5692
Enthusiast
Enthusiast

Jeff, Thanks for the help. I replaced the text you specified, but when I run it I get this 

#<VLA-OBJECT IAeccDocument 00000249a91e8de0>

0 Likes
Message 4 of 6

Jeff_M
Consultant
Consultant
Accepted solution

There was an extra parenthesis. Also, "BYLAYER" didn't work, I changed those to 256 which is Bylayer.

 

;|Command to globally change the MarkerDisplay and MarkerLabel color to BYLAYER
   to be used for all point styles.
   Created 8/4/2014 by Jeff Mishler of Quux Software
   Modified 6/5/2018 by Ian McClain of Stantec Consulting
|;
(defun c:PointLabelsBylayer
       (/ *acad* c3d c3ddoc enum prod prodstr siztyp)
  (vl-load-com)
  (defun getaeccApp (module / *acad* C3D)
    ;; module must be "Land", "Pipe", "Roadway", or "Survey"
    (vl-load-com)
    (if	(and (setq *acad* (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
			 (vlax-get-acad-object)
			 (strcat "AeccXUi"
				 module
				 ".Aecc"
				 (if (= (strcase module) "LAND")
				   ""
				   module
				 )
				 "Application."
				 C3D
			 )
		       )
	     )
	)
      C3D
    )
  )
  (setq c3d (getaeccapp "Land"))
  (setq C3Ddoc (vla-get-activedocument C3D))

  (vlax-for styl (vlax-get c3ddoc 'PointStyles)
    (vlax-put-property
      (vlax-get styl 'markerdisplaystyleplan)
      'color
      256
    )
    (vlax-put-property
      (vlax-get styl 'labeldisplaystyleplan)
      'color
      256
    )
    (vlax-put-property
      (vlax-get styl 'markerdisplaystylemodel)
      'color
      256
    )
    (vlax-put-property
      (vlax-get styl 'labeldisplaystylemodel)
      'color
      256
    )
    (vlax-put-property
      (vlax-get styl 'markerdisplaystyleprofile)
      'color
      256
    )
    (vlax-put-property
      (vlax-get styl 'markerdisplaystylesection)
      'color
      256
    )
    (princ "\nAll point styles updated!")
  )
  (princ)
)
Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 5 of 6

mikemcculley5692
Enthusiast
Enthusiast

Thanks Jeff_M! Quick question. If I wanted to change to BYBLOCK, what would I need to change 256 to?

0 Likes
Message 6 of 6

Jeff_M
Consultant
Consultant
Accepted solution
ByBlock = 0
Jeff_M, also a frequent Swamper
EESignature