Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change a linetype in a selection set of blocks with lisp

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
0
0
US
below is some code for selecting blocks. i would like to select all arcs nested in the blocks and force them to a continous linetype. i thought of using refedit but that expects a single object. the blocks have multiple names. i can select the blocks needed but I am stuck on where to go next.


Code:
(DEFUN C:hf ()
        (SETQ SCMDE (GETVAR "CMDECHO")) ;RETRIEVES COMMAND ECHO STATUS
	(SETVAR "CMDECHO" 0)					;SETS COMMAND ECHO STATUS TO "0" (TURNS IT OFF)
       
	(INITGET (+ 1 0 4 8 32))
        (SETQ SS1 (SSGET "x" '((0 . "INSERT")(-4 . "<XOR")(8 . "a-hist")(8 . "a-hist-2000")(-4 . "XOR>"))))
        
             ;RETRIEVES ALL History ENTITIES
		

        [COLOR=red]?????????????????????????????    ;retrieves all arcs in block and forces linetype to by layer [/color]
	(COMMAND "REDRAW")					;REFRESH SCREEN DISPLAY
	(SETVAR "CMDECHO" SCMDE)				;RESTORES COMMAND ECHO TO ORIGINAL VALUE
        (PRINC)                                                 ;PRINTS nil WHEN FINISHED (QUIET EXIT)
)
 
To change the block definition you will need to modify the table data for the blocks.

So after selecting the block inserts, you might make a list of all the block names from that set. Then for each block name, go into the block table data and step through the components. When an arc is found, modify its entity data so that the group code 6 is "bylayer".

To get to the block's "table name", use (setq TblName (tblobjname "block" "block name here"))

To step through the block's entities use 'entnext'

Unsolicited comments on your routine :)

The "initget" function has no effect on selecting objects with 'ssget' so can delete that line.

I believe the following 'ssget' line will do the same as yours (not better, just another way).

(setq ss1 (ssget "_x" '((0 . "INSERT")(8 . "a-hist-2000","a-hist"))))

Looks like you have some coding to do, let us know if you'd like some assistance :)
 
An easier methid came to mind, provided you are willing to select each arc/object you want to change......


;;User selects block nested entity to change
(setq e1 (car (nentsel "\nSelect object: ")))
;;Get entity's data
(setq edata (entget e1))
;;substitute "bylayer" property in data
(setq NewData (subst '(6 . "BYLAYER") (assoc 6 edata) edata))
;;modify entity data
(entmod edata)
;;regen to dispaly changes
(command "regen")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top