Tema: Re: ot: AUTOCAD 2018
Autorius: ejs
Data: 2019-05-24 11:55:36
2019-05-24 10:46, Spakainas rašė:
> Jei atvirai - tai px. Galvojau yra kažkoks paprastas būdas, kurio aš 
> tiesiog nežinau. Jei čia šokiai su būgnais, tai per tą laiką susikursiu 
> kelias naujas linijas rankytėmis :)

Yra, jis vadinasi programavimas :)
imi elementą, parsini pagal DXF aprašymą ir turi linijos tipą :)

					;	(defun c:getltype

(setq cEl (entget (car (entsel))))

(if cEl
   (progn
     (setq cLT (cdr (assoc 6 cEl)))

     (setq ltDescr (tblsearch "ltype" cLT))
     (setq ltDescr1 (tblobjname "ltype" cLT))
     (setq ltDescr1 (entget ltDescr1))
     (setq ltPref (chr (cdr (assoc 72 ltDescr1))))
     (setq inShape nil)


     (foreach lItem ltDescr1

       (if (= (car lItem) 340)		; shape or text
	(progn (setq inShape T)
	       (setq ltPref   (strcat ltPref ",[")
		     shpStyle (entget (cdr lItem))
	       )
	)

       )

       (if (= (car lItem) 49)		; dash, dot or space
	(progn (if inShape
		 ;; dump all he accumulated data
		 (progn
		   (if (= 2 isSHP)
		     (setq ltPref (strcat ltPref "\"" shpTXT "\",")
					; text
			   ltPref (strcat ltPref (cdr (assoc 2 shpStyle)) ",")
		     )
		   )
		   (if (= 4 isSHP)
		     (progn
		       (if (= 130 shpNum)
		     	(setq ltPref (strcat ltPref "TRACK1,"))
			 )
			   (setq ltPref (strcat ltPref (cdr (assoc 3 shpStyle)) ","))
		     )
		   )
					; style
		   (setq ltPref	(strcat ltPref "x=" shpX ",")
					; X offset
			 ltPref	(strcat ltPref "y=" shpY ",")
					; Y offset
			 ltPref	(strcat ltPref "r=" shpR ",")
					; rotation
			 ltPref	(strcat ltPref "s=" shpScale "]")
					; scale
		   )
		   (setq inShape nil)
		 )
	       )
	       (setq ltPref (strcat ltPref "," (rtos (cdr lItem))))
	)
       )
       (if (= (car lItem) 74)		; shape, text or rotation
	(setq isSHP (cdr lItem))
       )
       (if (= (car lItem) 75)		; shape number
	(setq shpNum (cdr lItem))
       )


       (if inShape
	(progn
	  (if (= (car lItem) 46)	; scale
	    (setq shpScale (rtos (cdr lItem)))
	  )

	  (if (= (car lItem) 44)	; X offset
	    (setq shpX (rtos (cdr lItem)))
	  )
	  (if (= (car lItem) 45)	; Y offset
	    (setq shpY (rtos (cdr lItem)))
	  )
	  (if (= (car lItem) 50)	; rotation in radians, R for relative and A 
for Absolute
	    (setq shpR (rtos (cdr lItem)))
	  )

	  (if (= (car lItem) 9)		; text string
	    (setq shpTXT (cdr lItem))
	  )
	)

       )
     )

     (print "Line type definition:")
     (print (strcat "*"
		   (cdr (assoc 2 ltDescr1))
		   ","
		   (cdr (assoc 3 ltDescr1))
	   )
     )
     (print ltPref)
   )
)


					;		)