POLYLINE TO BLOCK

POLYLINE TO BLOCK

pink_floid23
Enthusiast Enthusiast
2,139 Views
6 Replies
Message 1 of 7

POLYLINE TO BLOCK

pink_floid23
Enthusiast
Enthusiast

HI

want lisp convert all polylines to block attribute (every one is block ) , convert to same layers  and data , ( pipes 300 in it's layer and 400 in it's layer,,,etc ) 

 

0 Likes
Accepted solutions (1)
2,140 Views
6 Replies
Replies (6)
Message 2 of 7

ВeekeeCZ
Consultant
Consultant

Be so kind and fix your block.

 

(vl-load-com)

(defun c:Blockade (/ atq s i d l ps ep pt)

  (setq atq (getvar 'attreq)) (setvar 'attreq 0)
  
  (if (setq s (ssget '((0 . "LWPOLYLINE") (90 . 2))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i)))
	    d (getpropertyvalue e "Length")
	    l (cdr (assoc 8 (entget e)))
	    ps (vlax-curve-getstartpoint e)
	    pe (vlax-curve-getendpoint e)
	    pt (mapcar '/ (mapcar '+ ps pe) '(2 2)))
      (command "_.-insert" "pipe" "_s" (/ d 59.833333) "_r" (angtos (angle pe ps) (getvar 'aunits) 8) "_non" pt
	       "_.chprop" (setq e (entlast)) "" "_layer" l "")
      (setpropertyvalue e "DIAMETER" "900 mm")
      (setpropertyvalue e "LENGTH" "750 m")
      (setpropertyvalue e "SLOPE" "2.40%%%o")))
  (if s (command "_.erase" s ""))
  (setvar 'attreq atq)
  (princ)
  )

 

 
0 Likes
Message 3 of 7

pink_floid23
Enthusiast
Enthusiast

problem work , 

i need convert polyline to block , and replace the block with the block attribute , 

replace with the same polylines dimension and connected .not separated

0 Likes
Message 4 of 7

pink_floid23
Enthusiast
Enthusiast

I FIXED THE BLOCK , AND IT WORK , THANKS

BUT ANOTHER THING , WHEN USE LISP T2ATT TO UPDATE VALUE , IT'S NOT IN THE TRUE PLACE TO IT ,, DIAMETER VALUE IN LENGTH AND SLOPE GOSE TO DIAMETER ,,,, 

 

IF SOMETHING WRONG IN ATTRIBUTE SITTING PLEASE TELL ME , 

0 Likes
Message 5 of 7

ВeekeeCZ
Consultant
Consultant
Accepted solution

Dunno how happened that you have two blocks of the same name but different att order. Probably some routine messes these things up.

 

Use this mod.

 

(defun c:T2att (/ s e i c)

  (while (and (princ "\nSelect Text(s)")
	      (setq s (ssget  '((0 . "TEXT"))))
	      (or (setq e (car (entsel "\nSelect Block: ")))
		  (prompt " It's not a block!!")))
    (repeat (setq i (sslength s))
      (setq c (cdr (assoc 1 (entget (ssname s (setq i (1- i)))))))
      (cond ((wcmatch c "*mm*") (setpropertyvalue e "DIAMETER" c))
	    ((wcmatch c "*m*") (setpropertyvalue e "LENGTH" c))
	    (T (setpropertyvalue e "SLOPE" c)))))
  (princ)
  )

Anyway, consider this thread over from my side. No more "one more" things.

 

0 Likes
Message 6 of 7

pink_floid23
Enthusiast
Enthusiast

THANKS ALOT , LAST THING :

MAKE IT TO ALL IN ONE TIME  , NOT ONE BY ONE

0 Likes
Message 7 of 7

pink_floid23
Enthusiast
Enthusiast

hi , Mr pbejse , thanks for your help , 

just want one update to the lisp , cause i add new tag to it ,

 

0 Likes