Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LSP help in object property changes

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
gccdaemon
964 Views, 13 Replies

LSP help in object property changes

I'm a LSP noob trying to finish out this LSP routine, and I've run into a couple of problems. I'm not sure how to do the following:

 

1. Change text style.

2. Remove the "\C" and the "\F" color and font mtext format codes.

3. Use a wildcard in a linetype name.

 

The place I'm looking to do these tasks are marked with an "@" symbol at the front of the line in the code. Any help to get this working propperly would be greatly appreciated. This needs to be able to run in model, layout or block editor. Also any help exploding nested blocks would be appreciated as well.

 

(DEFUN C:FBLK ()
  (COMMAND "UNDO" "BE")
  (setq CMDECHO (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setq ORIGIN "0,0")
	3DF (ssget "x" '((0 . "3DFACE"))))
  (COMMAND 3df-2-3dp 3DF "");;Convert 3D faces
  (setq DIM  (ssget "x" '((-4 . "<or") (0 . "DIMENSION") (0 . "LEADER") (-4 . "or>"))))
  (COMMAND "._explode" DIM "");;Explode Dimensions
  (setq BLK (ssget "x" '((0 . "BLOCK"))))
  (COMMAND "._explode" BLK "");;Explode Blocks
  (setq POINT (ssget "x" '((0 . "POINT"))))
  (COMMAND "._erase" POINT "");;Delete Points
  (COMMAND "._change" "all" "" "P" "LA" "0" "LW" "BYLAYER" "");;Change to "0" layer and "Bylayer" lineweight
  (setq TXT  (ssget "x" '((-4 . "<or") (0 . "DIMENSION") (0 . "LEADER") (-4 . "or>"))))

@change mtext,text style arial

  (COMMAND "._change" TXT "P" "LT" "BYLAYER" "");;Change TXT to Bylayer Linetype

@remove mtext color and font format codes

  (setq GREY  (ssget "x" '((-4 . "<or")
			   (62 . "8")
			   (62 . "9")
			   (62 . "250")
			   (62 . "251")
			   (62 . "252")
			   (62 . "253")
			   (62 . "254")
			   (-4 . "or>")
			  )
	      )
  )
  (COMMAND "._change" GREY "P" "C" "253" "");;Set greys to 253
  (setq COLOR (ssget "x" '((-4 . "<not") (62 . "253") (-4 . "not>"))))
  (COMMAND "._change" COLOR "P" "C" "BYBLOCK" "");;Set non-greys to byblock
  (setq LTBL  (ssget "x" '((-4 . "<or") (6 . "CONTINUOUS") (6 . "BYBLOCK") (-4 . "or>"))))
  (COMMAND "._change" LTBL "P" "LT" "BYLAYER" "");;Set continuous and byblock linetype to bylayer

@change ltype dashdot*,center*,dgn*7,dgn*4 to ltype center3

@change ltype hidden*,dashed*,dot*,dgn*1,dgn*2,dgn*3,dgn*5 to ltype hidden3

@change ltype divide*,border*,phantom*,dgn*6, to ltype phantom3

  (setq PT1 (getpoint "Pick detail LOWER LEFT corner of detail:"))
  (COMMAND "._move "ALL" "" PT1 ORIGIN)
	   "._zoom" "E");;Move objects
  (setq PT2 (getpoint "Pick detail UPPER LEFT corner of detail:"))
  (COMMAND "._scale" "ALL" "" ORIGIN "R" ORIGIN PT2 "7");;Scale objects
	   "._erase" "1000,-1.05" "-5,-.05" "1000,7.05" "-5,8.05" "" "");;Erase objects
	   "UNDO" "E")
  (setvar "CMDECHO" CMDECHO)
  (princ)
)
;;
;;
;;
(defun c:3df-2-3dp ()
  (setq sset (ssget '((0 . "3DFACE"))))
  (if sset
    (progn
      (setq itm 0 num (sslength sset))
      (while (< itm num)
        (setq hnd (ssname sset itm))
        (setq ent (entget hnd))
        (setq pnt1 (cdr (assoc 10 ent)))
        (setq pnt2 (cdr (assoc 11 ent)))
        (setq pnt3 (cdr (assoc 12 ent)))
        (setq pnt4 (cdr (assoc 13 ent)))
        (entdel hnd)
        (command "_3DPOLY" pnt1 pnt2 pnt3 pnt4 "C")
        (setq itm (1+ itm))
      )
    )
  )
  (princ)
)
Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
13 REPLIES 13
Message 2 of 14
Kent1Cooper
in reply to: gccdaemon

Changing the linetypes of objects with an assortment of different linetypes into one is comparatively easy, since (ssget) filtering will take (wcmatch)-like multiple linetype names including wildcards:

 

(command "_.chprop" (ssget "X" '((6 . "dashdot*,center*,dgn*7,dgn*4"))) "" "_ltype" "center3" "")

 

EDIT:  But that is only for objects with a linetype override, not those whose linetype is Bylayer.  If you want those changed, too, you would want to have the routine look for Layers with those linetypes assigned to them, and change it in the Layer's data.

 

and similarly for the other groups.

 

To remove formatting from Mtext, look for the STRIPMTEXT routine by Steve Doman and Joe Burke [you'll find links with a Search here].

 

To change the text Style of things, I think you're going to need to step through the selection and do it one object at a time, either by (subst)/(entmod) or (vla-put...) means [again, a Search will yield lots of routines that do that kind of thing.

 

I also notice that you have (command "_.explode" ...) applied to a couple of selection sets.  Unfortunately, for whatever inscrutable reason, Explode inside a (command) function can't explode more than one thing at a time, unless you mess with the mysterious and undocumented QAFLAGS System Variable [also lots of examples if you Search for it here].

Kent Cooper, AIA
Message 3 of 14
hmsilva
in reply to: gccdaemon

in addition to what Kent Cooper have said, for the command explode, try

 

(setq ss (ssget))
(initcommandversion)
(vl-cmdf "_.explode" ss "")

 

HTH

Henrique

EESignature

Message 4 of 14
gccdaemon
in reply to: gccdaemon

Will VL explode work for nested blocks or do I have to try and figgure out a loop check (which I don't know how to do...lol)?

 

I've got the Stripmtext LSP file, but I'm too new to LSP to know what to pull from it or how to run the command with the font and color preselected and without a dialogue box.

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 5 of 14
hmsilva
in reply to: gccdaemon


@gccdaemon wrote:

Will VL explode work for nested blocks or do I have to try and figgure out a loop check (which I don't know how to do...lol)?

...


Try:

  (setq ss (ssget))
  (initcommandversion)
  (vl-cmdf "_explode" ss "")
  (while (setq ss (ssget "_P" '((0 . "INSERT"))))
  (initcommandversion)
  (vl-cmdf "_explode" ss "")
   );; while

 


@gccdaemon wrote:

... 

I've got the Stripmtext LSP file, but I'm too new to LSP to know what to pull from it or how to run the command with the font and color preselected and without a dialogue box.


Open the Stripmtext LSP, and inside you have examples how to use the code.
i.e.

Load the code

(load "StripMtext v5-0a");; your correct file name

(if (setq ss (ssget)) (StripMtext ss "*"));; all the options

 

HTH

Henrique

EESignature

Message 6 of 14
gccdaemon
in reply to: hmsilva

Not sure what's wrong, but I get a nil response before the program does anything.

 

(DEFUN C:FORMAT ()
  (setq CMDECHO (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(COMMAND "UNDO" "BE") (setq ORIGIN "0,0") 3DF (ssget "x" '((0 . "3DFACE")))) (COMMAND "3df-2-3dp" "");;Convert 3D faces (setq DIM (ssget "x" '((-4 . "<or") (0 . "DIMENSION") (0 . "LEADER") (-4 . "or>")))) (initcommandversion) (vl-cmdf "_explode" DIM "");;Explode Dimensions & Leaders (setq BLK (ssget "x" '((-4 . "<or") (0 . "BLOCK") (0 . "INSERT") (-4 . "or>")))) (initcommandversion) (vl-cmdf "_explode" BLK "") (while (setq BLK (ssget "x" '((-4 . "<or") (0 . "BLOCK") (0 . "INSERT") (-4 . "or>")))) (initcommandversion) (vl-cmdf "_explode" BLK "") );;Explode Blocks (COMMAND "._erase" (ssget "x" '((0 . "POINT"))) "");;Delete Points "._change" "all" "" "P" "LA" "0" "LW" "BYLAYER" "");;Change to "0" layer and "Bylayer" lineweight "ARIALTXT" "") "._change" TXT "P" "LT" "BYLAYER" "");;Change TXT to Bylayer Linetype (load "StripMtext v5-0b") (StripMtext (ssget "x" '((0 . "*TEXT"))) '("C" "F")));;remove mtext color and font format codes (COMMAND "._change" (ssget "x" '((62 . "8,9,250,251,252,253,254"))) "P" "C" "253" "");;Set greys to 253 "._change" (ssget "x" '((-4 . "<not") (62 . "253") (-4 . "not>"))) "" "P" "C" "BYBLOCK" "");;Set non-greys to byblock "._change" (ssget "X" '((6 . "CONTINUOUS,BYBLOCK"))) "" "P" "LT" "bylayer" "") "._change" (ssget "X" '((6 . "dashdot*,center*,dgn*7,dgn*4"))) "" "P" "LT" "center3" "") "._change" (ssget "X" '((6 . "hidden*,dashed*,dot*,dgn*1,dgn*2,dgn*3,dgn*5"))) "" "P" "LT" "hidden3" "") "._change" (ssget "X" '((6 . "divide*,border*,phantom*,dgn*6"))) "" "P" "LT" "phantom3" "") (setq PT1 (getpoint "Pick detail LOWER LEFT corner of detail:")) (COMMAND "._move" "all" "" PT1 ORIGIN) "._zoom" "E") (setq PT2 (getpoint "Pick detail UPPER LEFT corner of detail:")) (COMMAND "._scale" "ALL" "" ORIGIN "R" ORIGIN PT2 "7");;Scale objects "._erase" "1000,-1.05" "-5,-.05" "1000,7.05" "-5,8.05" "" "");;Erase objects "UNDO" "E") (setvar "CMDECHO" CMDECHO) (princ) ) ;; ;; ;; (defun c:3df-2-3dp () (setq sset (ssget '((0 . "3DFACE")))) (if sset (progn (setq itm 0 num (sslength sset)) (while (< itm num) (setq hnd (ssname sset itm)) (setq ent (entget hnd)) (setq pnt1 (cdr (assoc 10 ent))) (setq pnt2 (cdr (assoc 11 ent))) (setq pnt3 (cdr (assoc 12 ent))) (setq pnt4 (cdr (assoc 13 ent))) (entdel hnd) (command "_3DPOLY" pnt1 pnt2 pnt3 pnt4 "C") (setq itm (1+ itm)) ) ) ) (princ) ) ;; ;; ;; (defun C:ARIALTXT (/ entities len count ent ent_data ent_name new_style_name) (command "STYLE" "ARIAL" "ARIAL" "" "" "" "N" "N") (setq entities (ssget "x" '((0 . "*TEXT"))) len (sslength entities) count 0 ) (while (< count len) (setq ent (ssname entities count) ent_data (entget ent) ent_name (cdr (assoc 7 ent_data))) (setq new_style_name (cons 7 "ARIAL")) (setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data)) (entmod ent_data) (setq count (+ count 1)) ) (princ) )

 

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 7 of 14
hmsilva
in reply to: gccdaemon


@gccdaemon wrote:

Not sure what's wrong, but I get a nil response before the program does anything.

... 


I didn't reviewed the code, just removed perentesis from the command calls, and localized the variables...

Try it.

(DEFUN C:FORMAT ( / 3DF BLK CMDECHO DIM ORIGIN PT1 PT2 TXT)
  (setq CMDECHO (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (COMMAND "UNDO" "BE")
  (setq ORIGIN "0,0"
	3DF (ssget "x" '((0 . "3DFACE"))))
  (COMMAND "3df-2-3dp" "");;Convert 3D faces
  (setq DIM  (ssget "x" '((-4 . "<or") (0 . "DIMENSION") (0 . "LEADER") (-4 . "or>"))))
  (initcommandversion)
  (vl-cmdf "_explode" DIM "");;Explode Dimensions & Leaders
  (setq BLK (ssget "x" '((-4 . "<or") (0 . "BLOCK") (0 . "INSERT") (-4 . "or>"))))
  (initcommandversion)
  (vl-cmdf "_explode" BLK "")
  (while (setq BLK (ssget "x" '((-4 . "<or") (0 . "BLOCK") (0 . "INSERT") (-4 . "or>"))))
	 (initcommandversion)
	 (vl-cmdf "_explode" BLK "")
  );;Explode Blocks
  (COMMAND "._erase" (ssget "x" '((0 . "POINT"))) "";;Delete Points
    "._change" "all" "" "P" "LA" "0" "LW" "BYLAYER" "");;Change to "0" layer and "Bylayer" lineweight
(C:ARIALTXT);; to call the "ARIALTXT" routine
 (COMMAND "._change" TXT "P" "LT" "BYLAYER" "");;Change TXT to Bylayer Linetype
;; where are you setting the TXT variable? (load "StripMtext v5-0b") (StripMtext (ssget "x" '((0 . "*TEXT"))) '("C" "F"));;remove mtext color and font format codes (COMMAND "._change" (ssget "x" '((62 . "8,9,250,251,252,253,254"))) "P" "C" "253" "";;Set greys to 253 "._change" (ssget "x" '((-4 . "<not") (62 . "253") (-4 . "not>"))) "" "P" "C" "BYBLOCK" "";;Set non-greys to byblock "._change" (ssget "X" '((6 . "CONTINUOUS,BYBLOCK"))) "" "P" "LT" "bylayer" "" "._change" (ssget "X" '((6 . "dashdot*,center*,dgn*7,dgn*4"))) "" "P" "LT" "center3" "" "._change" (ssget "X" '((6 . "hidden*,dashed*,dot*,dgn*1,dgn*2,dgn*3,dgn*5"))) "" "P" "LT" "hidden3" "" "._change" (ssget "X" '((6 . "divide*,border*,phantom*,dgn*6"))) "" "P" "LT" "phantom3" "") (setq PT1 (getpoint "Pick detail LOWER LEFT corner of detail:")) (COMMAND "._move" "all" "" PT1 ORIGIN "._zoom" "E") (setq PT2 (getpoint "Pick detail UPPER LEFT corner of detail:")) (COMMAND "._scale" "ALL" "" ORIGIN "R" ORIGIN PT2 "7";;Scale objects "._erase" "1000,-1.05" "-5,-.05" "1000,7.05" "-5,8.05" "" "";;Erase objects "UNDO" "E") (setvar "CMDECHO" CMDECHO) (princ) );; C:FORMAT ;; ;; ;; (defun c:3df-2-3dp ( / ENT HND ITM NUM PNT1 PNT2 PNT3 PNT4 SSET) (setq sset (ssget '((0 . "3DFACE")))) (if sset (progn (setq itm 0 num (sslength sset)) (while (< itm num) (setq hnd (ssname sset itm)) (setq ent (entget hnd)) (setq pnt1 (cdr (assoc 10 ent))) (setq pnt2 (cdr (assoc 11 ent))) (setq pnt3 (cdr (assoc 12 ent))) (setq pnt4 (cdr (assoc 13 ent))) (entdel hnd) (command "_3DPOLY" pnt1 pnt2 pnt3 pnt4 "C") (setq itm (1+ itm)) ) ) ) (princ) );; c:3df-2-3dp ;; ;; ;; (defun C:ARIALTXT (/ entities len count ent ent_data ent_name new_style_name) (command "STYLE" "ARIAL" "ARIAL" "" "" "" "N" "N") (setq entities (ssget "x" '((0 . "*TEXT"))) len (sslength entities) count 0 ) (while (< count len) (setq ent (ssname entities count) ent_data (entget ent) ent_name (cdr (assoc 7 ent_data))) (setq new_style_name (cons 7 "ARIAL")) (setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data)) (entmod ent_data) (setq count (+ count 1)) ) (princ) );; C:ARIALTXT

HTH

Henrique

 

 

EESignature

Message 8 of 14
gccdaemon
in reply to: gccdaemon

O.k. So i disabled the CMDECHO to see where the problems were comming in at, and I get problems with these items.

 

  (COMMAND "._change" (ssget "x" '((62 . 8) (62 . 9) (62 . 250) (62 . 251) (62 . 252) (62 . 253) (62 . 254))) "" "P" "C" "253" "")

  (COMMAND "._change" (ssget "x" '((-4 . "<not") (62 . "253") (-4 . "not>"))) "" "P" "C" "BYBLOCK" "")

  (COMMAND "._change" (ssget "X" '((6 . "CONTINUOUS,BYBLOCK"))) "" "P" "LT" "bylayer" "")

  (COMMAND "._change" (ssget "X" '((6 . "dashdot*,center*,dgn*7,dgn*4"))) "" "P" "LT" "center3" "")

  (COMMAND "._change" (ssget "X" '((6 . "hidden*,dashed*,dot*,dgn*1,dgn*2,dgn*3,dgn*5"))) "" "P" "LT" "hidden3" "")

  (COMMAND "._change" (ssget "X" '((6 . "divide*,border*,phantom*,dgn*6"))) "" "P" "LT" "phantom3" "")

First two items arn't changing colors of items. I had been adding (-4 . "or>") and get the same result.

 

Last 4 are giving me "error: bad SSGET list value"

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 9 of 14
hmsilva
in reply to: gccdaemon

Andrew,

 

is advisable to test if exists selected objects before call a command

(if (setq ss (ssget "_X"
		    '((-4 . "<OR")
		      (62 . 8)
		      (62 . 9)
		      (62 . 250)
		      (62 . 251)
		      (62 . 252)
		      (62 . 253)
		      (62 . 254)
		      (-4 . "OR>")
		     )
	     )
    )
  (command "._change" ss "" "P" "C" "253" "")
)

(if (setq ss (ssget "x" '((-4 . "<not") (62 . 253) (-4 . "not>"))))
  (COMMAND "._change" ss "" "P" "C" "BYBLOCK" "")
  )

 

(if (setq ss (ssget "X" '((6 . "CONTINUOUS,BYBLOCK"))))
  (COMMAND "._change" ss "" "P" "LT" "bylayer" "")
  )

 (if (setq ss (ssget "X" '((6 . "dashdot*,center*,dgn*7,dgn*4"))))
   (COMMAND "._change" ss "" "P" "LT" "center3" "")
   )
    
(if (setq ss (ssget "X" '((6 . "hidden*,dashed*,dot*,dgn*1,dgn*2,dgn*3,dgn*5"))))
  (COMMAND "._change"  "" "P" "LT" "hidden3" "")
  )

(if (setq ss (ssget "X" '((6 . "divide*,border*,phantom*,dgn*6"))))
  (COMMAND "._change"  "" "P" "LT" "phantom3" "")
  )

 HTH

Henrique 

 

 

EESignature

Message 10 of 14
Kent1Cooper
in reply to: gccdaemon


@gccdaemon wrote:

O.k. So i disabled the CMDECHO to see where the problems were comming in at, and I get problems with these items.

 

  (COMMAND "._change" (ssget "x" '((62 . 8) (62 . 9) (62 . 250) (62 . 251) (62 . 252) (62 . 253) (62 . 254))) "" "P" "C" "253" "")

  (COMMAND "._change" (ssget "x" '((-4 . "<not") (62 . "253") (-4 . "not>"))) "" "P" "C" "BYBLOCK" "")

  (COMMAND "._change" (ssget "X" '((6 . "CONTINUOUS,BYBLOCK"))) "" "P" "LT" "bylayer" "")

  (COMMAND "._change" (ssget "X" '((6 . "dashdot*,center*,dgn*7,dgn*4"))) "" "P" "LT" "center3" "")

  (COMMAND "._change" (ssget "X" '((6 . "hidden*,dashed*,dot*,dgn*1,dgn*2,dgn*3,dgn*5"))) "" "P" "LT" "hidden3" "")

  (COMMAND "._change" (ssget "X" '((6 . "divide*,border*,phantom*,dgn*6"))) "" "P" "LT" "phantom3" "")

First two items arn't changing colors of items. I had been adding (-4 . "or>") and get the same result.

 

Last 4 are giving me "error: bad SSGET list value"


For the first one, you don't say how you added the 4-or thing, but for me it works like this:

(ssget "x" '((-4 . "<or") (62 . 😎 (62 . 9) (62 . 250) (62 . 251) (62 . 252) (62 . 253) (62 . 254) (-4 . "or>")))

 

For the second, try taking the double-quotes away from around the 253 [it should be an integer, not a string].

 

For the last four, that (ssget) filter-list format works for me [I tried your last one and it found things of a couple of those linetypes].

 

[And by the way, if you use the CHPROP command, rather than CHANGE, you can omit the "P" option from all of those.]

Kent Cooper, AIA
Message 11 of 14
gccdaemon
in reply to: Kent1Cooper

I found a work around. I did those things you suggested and the 62 codes just wouldn't add anything to the SS. I substituted this for what you had proposed and it works like a charm now.

 

  (foreach C '(8 9 250 251 252 253 254)
	      (and (setq GREY (ssget "X" (list (cons 62 C))))
		   (COMMAND "._change" GREY "" "P" "C" "253" "")))

 

Thank you all for your help, I've learned a TON and props to everyone!

 

Here is the final product.

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 12 of 14
hmsilva
in reply to: gccdaemon

Thanks for sharing your final code, Andrew.
Glad you got a solution.

 

Henrique

EESignature

Message 13 of 14
Lee_Mac
in reply to: gccdaemon

Here is another way you could write it Andrew:

 

(if
    (setq sel
        (ssget "_X"
           '(
                (-4 . "<OR")
                    (62 . 8)
                    (62 . 9)
                    (-4 . "<AND")
                        (-4 . ">=")
                        (62 . 250)
                        (-4 . "<=")
                        (62 . 254)
                    (-4 . "AND>")
                (-4 . "OR>")
            )
        )
    )
    (command "_.chprop" sel "" "_C" 253 "")
)
(if (setq sel (ssget "_X" '((-4 . "<>") (62 . 253))))
    (command "_.chprop" sel "" "_C" "byblock" "")
)
(foreach x
   '(
        ("continuous,byblock"              "bylayer")
        ("dashdot*,center*,dgn*[74]"       "center3")
        ("hidden*,dashed*,dot*,dgn*[1235]" "hidden3")
        ("divide*,border*,phantom*,dgn*6"  "phantom3")
    )
    (if (setq sel (ssget "_X" (list (cons 6 (car x)))))
        (command "_.chprop" sel "" "_LT" (cadr x) "")
    )
)
Message 14 of 14
gccdaemon
in reply to: Lee_Mac

Wound up getting this portion to work flawlessly. Currently working on a couple of additional options to go with it Like deleting the outer boundaries from detail titleblocks and a few other cool functions.

(DEFUN C:DTF nil (c:DETAIL))
(DEFUN C:DETAIL ( / 3DF BLK PNT CMD DIM DIM2 PT1 PT2 TXT GREY LT1 LT2 LT3 LT4 COLOR)
  (setq CMD (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (COMMAND "UNDO" "BE")
  (if (setq 3DF (ssget "x" '((0 . "3DFACE"))))
      (C:3df23dp))
  (if (setq DIM  (ssget "x" '((-4 . "<or") (0 . "DIMENSION") (0 . "LEADER") (-4 . "or>"))))
      (initcommandversion)
      (vl-cmdf "_explode" DIM ""))
  (while (setq DIM (ssget "x" '((-4 . "<or") (0 . "DIMENSION") (0 . "LEADER") (-4 . "or>"))))
      (initcommandversion)
      (vl-cmdf "_explode" DIM ""))
  (if (setq BLK (ssget "x" '((-4 . "<or") (0 . "BLOCK") (0 . "INSERT") (-4 . "or>"))))
      (initcommandversion)
      (vl-cmdf "_explode" BLK ""))
  (while (setq BLK (ssget "x" '((-4 . "<or") (0 . "BLOCK") (0 . "INSERT") (-4 . "or>"))))
      (initcommandversion)
      (vl-cmdf "_explode" BLK ""))
  (if (setq PNT (ssget "x" '((0 . "POINT"))))
      (COMMAND "._erase" PNT ""))
  (C:ARIALTXT)
  (COMMAND "._change" (ssget "x" '((0 . "*"))) "" "P" "LA" "0" "LW" "BYLAYER" "")
  (if (setq TXT (ssget "x" '((0 . "*TEXT"))))
      (COMMAND "._change" TXT "" "P" "LT" "BYLAYER" ""))
  (foreach C '(8 9 250 251 252 253 254)
	      (and (setq GREY (ssget "X" (list (cons 62 C))))
		   (COMMAND "._change" GREY "" "P" "C" "253" "")))
  (if (setq LT1 (ssget "X" '((6 . "continuous,byblock"))))
      (COMMAND "._change" LT1 "" "P" "LT" "bylayer" ""))
  (if (setq LT2 (ssget "X" '((6 . "dashdot*,center*,dgn*7,dgn*4"))))
      (COMMAND "._change" LT2 "" "P" "LT" "center3" ""))
  (if (setq LT3 (ssget "X" '((6 . "hidden*,dashed*,dot*,dgn*1,dgn*2,dgn*3,dgn*5"))))
      (COMMAND "._change" LT3 "" "P" "LT" "hidden3" ""))
  (if (setq LT4 (ssget "X" '((6 . "divide*,border*,phantom*,dgn*6"))))
      (COMMAND "._change" LT4 "" "P" "LT" "phantom3" ""))
  (if (setq COLOR (ssget "x" '((-4 . "<not") (62 . 253) (-4 . "not>"))))
      (COMMAND "._change" COLOR "" "P" "C" "BYBLOCK" ""))
  (setq PT1 (getpoint "Pick LOWER LEFT corner of detail titleblock:"))
  (princ PT1)
  (COMMAND "._move" "all" "" PT1 "0,0"
                  "._zoom" "E")
  (setq PT2 (getpoint "Pick UPPER LEFT corner of detail titleblock:"))
  (princ PT2)
  (COMMAND "._scale" "ALL" "" "0,0" "R" "0,0" PT2 "7")
"._zoom" "E") (StripMtext (ssget "x" '((0 . "*TEXT"))) '("C" "F")) (COMMAND "UNDO" "E") (setvar "CMDECHO" CMD) (princ) ) ;; ;; ;; (defun c:3df23dp ( / ENT HND ITM NUM PNT1 PNT2 PNT3 PNT4 SSET) (setq sset (ssget "x" '((0 . "3DFACE")))) (if sset (progn (setq itm 0 num (sslength sset)) (while (< itm num) (setq hnd (ssname sset itm)) (setq ent (entget hnd)) (setq pnt1 (cdr (assoc 10 ent))) (setq pnt2 (cdr (assoc 11 ent))) (setq pnt3 (cdr (assoc 12 ent))) (setq pnt4 (cdr (assoc 13 ent))) (entdel hnd) (command "_3DPOLY" pnt1 pnt2 pnt3 pnt4 "C") (setq itm (1+ itm)) ) ) ) (princ) ) ;; ;; ;; (defun C:ARIALTXT (/ entities len count ent ent_data ent_name new_style_name) (command "-STYLE" "ARIAL" "ARIAL" "" "" "" "" "") (setq entities (ssget "x" '((0 . "*TEXT"))) len (sslength entities) count 0 ) (while (< count len) (setq ent (ssname entities count) ent_data (entget ent) ent_name (cdr (assoc 7 ent_data))) (setq new_style_name (cons 7 "ARIAL")) (setq ent_data (subst new_style_name (assoc 7 ent_data) ent_data)) (entmod ent_data) (setq count (+ count 1)) ) (princ) ) (princ)

 

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram

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

Post to forums  

Autodesk Design & Make Report

”Boost