Author Topic: Matchprop Brush  (Read 2542 times)

0 Members and 1 Guest are viewing this topic.

andy_lee

  • Newt
  • Posts: 147
Matchprop Brush
« on: September 25, 2014, 02:18:26 AM »
Hey all,
This routine have a few questions.
"Linetype" and "Linetype scale"
Can not copy Linetype & Linetype scale of LINE to PLINE.
Can not copy Linetype & Linetype scale of PLINE to LINE

New questions  at #10  ,Need help.

Code: [Select]
brush : dialog {    label = "Classification format brush";    : boxed_column {        label = "Select  project to brush";        : row {            : column {                : toggle {                    label = "linetype";                    key = "xx";                    mnemonic = "E";                    fixed_width = true;                }                  : toggle {                    label = "Linetype Scale";                    key = "xxbl";                    mnemonic = "M";                    fixed_width = true;                } 
                : toggle {
                    label = "Color";
                    key =  "yc";
    width=16;
                    fixed_width = true;
                } 
                : toggle {
                    label = "Text type";
                    key = "wzlx";
                    mnemonic = "N";
                    fixed_width = true;
                } 
                : toggle {
                    label = "Text height";
                    key = "zg";
                    mnemonic = "Q";
                    fixed_width = true;
                } 
                : toggle {
                    label = "Width Factor";
                    key = "zxbl";
                    mnemonic = "I";
                    fixed_width = true;
                } 
: toggle {
                    label = "Text content";
                    key = "wznr";
                    mnemonic = "I";
                    fixed_width = true;
                } 

            }
            : column {
                : toggle {
                    label = "Dimension Style";
                    key = "cc";
                    mnemonic = "s";
width=15;
                    fixed_width = true;
                } 
                : toggle {
                    label = "Layer";
                    key = "c";
                    mnemonic = "d";
                    fixed_width = true;
                } 
                : toggle {
                    label = "Unknown1";
                    key = "jt";
                    mnemonic = "T";
                    fixed_width = true;
                } 
                : toggle {
                    label = "Text Angle";
                    key = "ztjd";
                    mnemonic = "a";
                    fixed_width = true;
                } 
           



: toggle {
                   label = "Circle, arc radius";
                   key = "bj";
                   mnemonic = "p";
                   fixed_width = true;
                }
: toggle {
                    label = "Unknown2";
                    key = "scjd";
                    mnemonic = "u";
                    fixed_width = true;
                } 






            } //column



        } //row

:text{
value="-----------------------------------------------------------------------------------";
is_bold=false;
height=1;}

:row{   : toggle {
                    label = "Reverse selected";
                    key = sf;
                    mnemonic = "u";
                    fixed_width = true;
                } 

 : toggle {
                    label = "Remember";
                    key = jzxz;
                    mnemonic = "u";
                    fixed_width = true;
                }   
}

} //box


:row{

:text{
value="Filter";
is_bold=false;
height=1;}
 : toggle {
                    label = "All/Box";
                    key = qx;
                    mnemonic = "u";
                    fixed_width = true;
                }   


}//endrow

 
:boxed_row{
:column{ 
:popup_list{
key="tt1";
width=10;
list="";
}

:popup_list{
key="tt2";
width=10;
list="";
}
}


:column{ 
:popup_list{
key="tt3";
width=10;
list="";
}

:popup_list{
key="tt4";
width=10;
list="";
}
}
}//endrow
ok_cancel;
} //dialog


[LISP]

Code - Auto/Visual Lisp: [Select]
  1. (defun c:ddbrush(/ sss ee leng n ss standard ok)
  2. (setq sss (entsel "Select source object") )
  3. (setq mother (entget (car sss)))
  4. (setq moname (cdr (assoc 0 mother)))
  5. (setq standard (list -3 '("ACAD" (1000 . "DSTYLE") (1002 . "{") (1002 . "}"))))
  6. (setq id (load_dialog "ddbrush.dcl"))
  7. (if (not (new_dialog "brush" id))
  8.         (exit)
  9. )
  10.  
  11.  
  12. (if (= jzxz 1) (init))
  13. (initl)
  14. ;--------------------
  15. (setq mc (assoc 8 mother) mx  (assoc 6 mother) my  (assoc 62 mother))
  16. (setq myy (cadr (assoc (cdr mc) nn1)) mxx (caddr (assoc (cdr mc) nn1)))
  17. ;--------------------------
  18.  
  19. (setq ok 0)
  20. (action_tile "accept" "(do_set)(done_dialog 1)")
  21. (if (= ok 0) (exit))
  22.  
  23.  
  24. (prompt "Select destination object")
  25. (if (= qx 1) (setq ss (ssget "x")) (setq ss (ssget ) ))
  26. (print "Please be patient, the program is being processed......")
  27. (setq leng (sslength ss) n 0 str "")
  28. (repeat leng
  29.         (setq ee (ssname ss n))
  30.         (setq aa (entget ee))
  31.         (setq name (cdr (assoc 0 aa)))
  32.  
  33. (setq yesno f)
  34. (if (and (= tt1 0) (= tt2 0) (= tt3 0) (= tt4 0)) (setq yesno t)
  35.         (progn
  36.         (setq tc (assoc 8 aa) tx  (assoc 6 aa) ty  (assoc 62 aa))
  37.         (setq tyy (cadr (assoc (cdr tc) nn1)) txx (caddr (assoc (cdr tc) nn1)))
  38.        
  39.  
  40.         (setq ttt1 f)
  41.         (if (= tt1 0) (setq ttt1 t))
  42.         (if (and (not (= tt1 0)) (= (car (nth (1- tt1) nn1)) (cdr tc)))        (setq ttt1 t) )
  43.        
  44.  
  45.        
  46.         (setq ttt2 f)
  47.         (if (= tt2 0) (setq ttt2 t)                                                        
  48.                 (if  (NULL tx)  
  49.                         ( if (= (nth (1- tt2) nn2) txx) (setq ttt2 t))
  50.                         (if (= (nth (1- tt2) nn2) (cdr tx)) (setq ttt2 t))
  51.                 )
  52.         )
  53.  
  54.  
  55.         (setq ttt3 f)                                                                        
  56.         (if (= tt3 0) (setq ttt3 t)
  57.                 (if (NULL ty)
  58.                         ( if (= tt3  tyy) (setq ttt3 t))
  59.                         (if (= tt3 (cdr ty))  (setq ttt3  t))
  60.                 )
  61.         )
  62.  
  63.        
  64.        
  65.         (setq ttt4 f)                                                                      
  66.         (if (= tt4 0) (setq ttt4 t)
  67.                 (if (= (nth (1- tt4) nn4) name) (setq ttt4 t))
  68.         )
  69.  
  70.  
  71.  
  72.         (setq yesno (and ttt1 ttt2 ttt3 ttt4))
  73.        
  74.         );endprogn
  75. );endif
  76.  
  77.  
  78. (if (= yesno t)
  79.         (progn
  80. ( if (and (or (= moname "DIMEMSION") (= moname "CIRCLE") (= moname "ARC") (= moname "INSERT") (= moname "LINE") (= moname "PLINE")  (= moname "LEADER"))
  81.           (or (= name "DIMEMSION") (= name "INSERT") (= name "LINE")  (= name "CIRCLE") (= name "ARC") (= name "PLINE")  (= name "LEADER")))
  82.         (progn
  83.         (if (= xx 1) (myreplace 6))                                                        
  84.         (if (= xxbl 1) (myreplace 48))                                                      
  85.         );ENDPROGN
  86. )        ;ENDIF
  87.        
  88.  
  89.  
  90. (if (and (or (= name "TEXT") (= name "MTEXT") (= name "ATTDEF")) (or (= moname "TEXT") (= moname "MTEXT") (= moname "ATTDEF")))
  91.         (progn
  92.         (if (= wzlx 1) (myreplace 7))                                                        
  93.        
  94.         (if (= zxbl 1) (if  (or (= moname "MTEXT") (= name "MTEXT")) ()        (myreplace 41)))
  95.         (if (= zg 1) (myreplace 40))                                                        
  96.        
  97.         (if (= ztjd 1) (myreplace 50))                                                        
  98.         (if (= ztjd 1) (myreplace 51))                                                        
  99.         );;endprogn
  100. );;endif        
  101.  
  102. (if (and (or (= name "TEXT") (= name "MTEXT") (= name "DIMENSION")) (or (= moname "TEXT") (= moname "MTEXT") (= moname "DIMENSION")))
  103.         (if (= wznr 1) (myreplace 1))                                                        
  104. )
  105.  
  106.  
  107. (if (and (= moname "DIMENSION") (= "DIMENSION" name))
  108.         (if (= cc 1)
  109.                 (progn
  110.                 (modim)
  111.                 (myreplace 3)                                                                
  112.                 )                                                                        
  113.         )
  114. )        
  115.  
  116. (if (and (= moname "SOLID") (= name "SOLID") (= jt 1)) (mysol))                                
  117.        
  118. (if (and (or (= moname "CIRCLE") (= moname "ARC")) (or (= name "CIRCLE") (= name "ARC")) (= bj 1)) (myreplace 40))  
  119.  
  120.  
  121.         (if (= c 1) (myreplace 8))                
  122.         (if (= yc 1) (myreplace 62))                
  123.         );;;;endprogn
  124. );;;;;endif
  125.  
  126.  
  127.    
  128. (setq n (1+ n))
  129. )        ;endrep
  130.  
  131. (setq ss nil)
  132. (command "line" '(0 0) "")                
  133.  
  134.  
  135. )        ;endfun
  136.  
  137. (defun modim( / exmo exmo3 exch)
  138.  
  139. (setq exmo (entget (car sss) '("ACAD")))
  140. (setq exmo3 (assoc -3 exmo))
  141. (setq exch (entget ee '("ACAD")))
  142. (setq exch3 (assoc -3 exch))
  143. (princ "\nsecond\n\n")
  144. (princ exch)
  145. (princ "\n\n first\n")
  146. (princ exmo3)
  147.  
  148.   (cond
  149.     ((and exmo3 exch3) (setq exch (subst exmo3 (assoc -3 exch) exch)))
  150.     ((and exmo3 (not exch3))(setq exch (append exch (list  exmo3))))
  151.     ((and (not exmo3) exch3) (setq  exch (subst standard (assoc -3 exch) exch)))
  152.     )
  153. ;;;(if (not (or (NULL (assoc -3 exch)) (NULL exmo3))) (setq exch (subst exmo3 (assoc -3 exch) exch)))
  154. ;;;(if (NULL (assoc -3 exch))  (setq exch (append exch (list  exmo3))))
  155. ;;;(if (NULL exmo3) (setq  exch (subst standard (assoc -3 exch) exch)))
  156.  
  157.  
  158. (princ "\n\nstart newsecond\n")
  159. (princ exch)
  160. (princ "\n\nend\n")
  161. (entmod exch)
  162. )
  163.  
  164.  
  165. (defun myreplace(attrib / variey1 variey2 variety xxxx yyyy)
  166.  
  167. (if (NULL variey1) (setq variey1  (assoc attrib aa)))
  168. (setq variey2 (cdr (assoc attrib mother)))
  169. (if (NULL variey2) (setq variey2  (assoc attrib mother)))
  170.  
  171.  
  172. (if (and (not (null variey1)) (not (null variey2)))          
  173.                         (progn (setq aa
  174.                               (subst (cons attrib variey2) (assoc                         attrib aa) aa)) (entmod aa))                )                
  175.        
  176.  
  177.                
  178. (if (and  (null variey1) (not (null variey2)) ) (setq aa (append aa                         (list  (assoc attrib mother))))
  179. )  
  180.  
  181.  
  182.  
  183. (if (= scjd 1) (setq xxxx mxx yyyy myy) (setq xxxx "BYLAYER" yyyy 256))  
  184.  
  185. (if (and (not (null variey1)) (null variey2) (= attrib 6)) (setq aa   (subst (cons attrib xxxx) (assoc attrib aa) aa)) )        
  186. (if  (and (not (null variey1)) (null variey2) (= attrib 62)) (setq aa   (subst (cons attrib yyyy) (assoc attrib aa) aa)))                
  187.  
  188.  
  189.  
  190. (if (and (null variey1) (null variey2) (= attrib 6))  (setq aa (append aa (list  (cons attrib xxxx))))        )
  191. (if (and (null variey1) (null variey2) (= attrib 62))  (setq aa (append aa (list  (cons attrib yyyy))))        )
  192.  
  193.  
  194.  
  195. (if (and (not (null variey1)) (null variey2)  (= attrib 48 )) (progn (setq aa   (subst (cons attrib 1) (assoc attrib aa) aa)) (princ "ok") (princ aa)))              
  196. (entmod aa)
  197. )  ;endsubfun
  198.  
  199.  
  200. (defun mysol(/ ll pt0 pt1)                                                  
  201. (setq ll (distance (cdr (assoc 10 mother)) (cdr (assoc 13 mother))))
  202.                 (setq pt0 (cdr (assoc 10 aa)) pt1 (cdr (assoc 11  aa)) pt3 (cdr (assoc 13  aa)))
  203.                 (setq rate (/ ll (distance pt0 pt3)))
  204.                 (setq pt0 (snpt pt3 pt0 rate) pt1 (snpt pt3 pt1 rate))                
  205.                 (setq aa                
  206.                         (subst (cons 10 pt0) (assoc 10 aa) aa)
  207.                 )  
  208.                 (setq aa                
  209.                         (subst (cons 11 pt1) (assoc 11 aa) aa)
  210.                 )  
  211.  
  212.         (entmod aa)
  213. )
  214.  
  215. (defun snpt(p1 p2 rate / sx1 sx2 sx3 sy1 sy2 sy3 )
  216. (setq sx1 (car p1) sy1 (cadr p1) sx2 (car p2) sy2 (cadr p2))
  217. (setq sx3 (+ (* rate (- sx2 sx1)) sx1) )
  218. (setq sy3 (+ (* rate (- sy2 sy1)) sy1) )
  219. (list sx3 sy3 0.0)
  220. )
  221.  
  222. (defun do_set(/ n)
  223. (setq sf (atoi (get_tile "sf")))
  224. (setq jzxz (atoi (get_tile "jzxz")))
  225.  
  226. (if (= sf 1) (setq n 1) (setq n 0))
  227.  
  228. (setq xx (+ (atoi (get_tile "xx")) n))
  229. (setq xxbl (+ (atoi (get_tile "xxbl")) n))
  230. (setq yc (+ (atoi (get_tile "yc")) n))
  231. (setq wzlx (+ (atoi (get_tile "wzlx")) n))
  232. (setq  zg (+ (atoi (get_tile "zg")) n))
  233. (setq zxbl (+ (atoi (get_tile "zxbl")) n))
  234. (setq wznr (+ (atoi (get_tile "wznr")) n))
  235.  
  236. (setq cc (+ (atoi (get_tile "cc")) n))
  237. (setq c (+ (atoi (get_tile "c")) n))
  238. (setq jt (+ (atoi (get_tile "jt")) n))
  239. (setq ztjd (+ (atoi (get_tile "ztjd")) n))
  240. (setq bj (+ (atoi (get_tile "bj")) n))
  241. (setq scjd (+ (atoi (get_tile "scjd")) n))
  242.  
  243. (setq tt1 (atoi (get_tile "tt1")))
  244. (setq tt2 (atoi (get_tile "tt2")))
  245. (setq tt3 (atoi (get_tile "tt3")))
  246. (setq tt4 (atoi (get_tile "tt4")))
  247.  
  248. (setq qx (atoi (get_tile "qx")))
  249. (setq ok 1)
  250.  
  251. )
  252.  
  253. (defun init()
  254.  
  255. (set_tile "jzxz" (itoa jzxz))
  256. (if (= sf 1) (setq n 1) (setq n 0))
  257. (set_tile "sf" (itoa sf))
  258. (set_tile "xx" (itoa (- xx n)))
  259. (set_tile "xxbl" (itoa (- xxbl n)))
  260. (set_tile "yc" (itoa (- yc n)))
  261. (set_tile "wzlx" (itoa (- wzlx n)))
  262. (set_tile "zg" (itoa (- zg n)))
  263. (set_tile "zxbl" (itoa (- zxbl n)))
  264. (set_tile "wznr" (itoa (- wznr n)))
  265.  
  266. (set_tile "cc" (itoa (- cc n)))
  267. (set_tile "c" (itoa (- c n)))
  268. (set_tile "jt" (itoa (- jt n)))
  269. (set_tile "ztjd" (itoa (- ztjd n)))
  270. (set_tile "bj" (itoa (- bj n)))
  271. (set_tile "scjd" (itoa (- scjd n)))
  272.  
  273. (set_tile "qx" (itoa qx))
  274. )
  275.  
  276. (defun initl()
  277. (setq nn1 '() nn2 '() nn3 '() nn4 '("LINE" "PLINE" "CIRCLE" "ARC" "TEXT" "MTEXT" "ATTDEF" "DIMENSION" "INSERT" "SOLID") n 0)
  278. (start_list "tt1" 3)
  279. (add_list "layer filter (No filter)")
  280. (setq blk (tblnext "LAYER" 1))
  281.  
  282. (while (not (NULL blk))
  283. (setq n (1+ n))
  284. (setq tname (cdr (nth 1 blk)))
  285. (setq nn1 (append nn1 (list (list  tname (cdr (nth 3 blk)) (cdr (nth 4 blk))))))
  286. (add_list tname)
  287. (setq blk (tblnext "LAYER" NIL))
  288. )
  289.  
  290.  
  291. (start_list "tt2" 3)
  292. (add_list "Linear filter(NO filter)")
  293. (setq blk (tblnext "LTYPE" 1))
  294. (while (not (NULL blk))
  295. (setq tname (cdr (nth 1 blk)))
  296. (setq nn2 (append nn2 (list  tname)))
  297. (add_list tname)
  298. (setq blk (tblnext "LTYPE" NIL))
  299.  
  300. )
  301.  
  302. (start_list "tt3" 3)
  303. (add_list "Color filter(NO filter)")
  304. (setq n 0)
  305. (repeat 255
  306. (setq n (1+ n))
  307. )
  308.  
  309. (start_list "tt4" 3)
  310. (add_list "Filter entities(NO filter)")
  311. (setq n 0)
  312. (setq len (length nn4))
  313. (repeat len
  314.  
  315. (add_list (nth n nn4))
  316. (setq n (1+ n))
  317. )
  318.  
  319. )
« Last Edit: June 05, 2015, 04:15:26 AM by emk2012 »
andy.
Best regards.

andy_lee

  • Newt
  • Posts: 147
Re: Brush attribute
« Reply #1 on: September 25, 2014, 08:45:54 PM »
"Linetype"brush  and "Linetype scale" brush ,  any one can help ?
andy.
Best regards.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Brush attribute
« Reply #2 on: September 25, 2014, 09:56:15 PM »

What is 'brush' ??
I refuse to look at your code closely because the variable names have no meaning to me.

If you change the variable names to reflect the nature of the value they hold your code will be a little easier to read.

 
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

JAY

  • Newt
  • Posts: 105
Re: Brush attribute
« Reply #3 on: September 28, 2014, 08:26:14 PM »

What is 'brush' ??
I refuse to look at your code closely because the variable names have no meaning to me.

If you change the variable names to reflect the nature of the value they hold your code will be a little easier to read.

I think that is written by Chinese people . :lmao:

Gasty

  • Newt
  • Posts: 90
Re: Brush attribute
« Reply #4 on: September 28, 2014, 08:51:53 PM »
Hi,

My guess is that he is trying to mimic the "Painter" command.

Gaston Nunez

JAY

  • Newt
  • Posts: 105
Re: Brush attribute
« Reply #5 on: September 28, 2014, 09:32:52 PM »
No, I think is mimic the "matchprop" command.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Brush attribute
« Reply #6 on: September 28, 2014, 10:12:02 PM »
No, I think is mimic the "matchprop" command.

Same command :)

Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

JAY

  • Newt
  • Posts: 105
Re: Brush attribute
« Reply #7 on: September 28, 2014, 10:24:02 PM »
You are right ,Kerry  :wink:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Brush attribute
« Reply #8 on: September 28, 2014, 11:04:53 PM »

emk2012

From a quick look ;

Some of the keys in your DCL are not strings ... they should be.
//------------

(= moname "PLINE") and
(= name "PLINE")

should be type "LWPOLYLINE"
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

andy_lee

  • Newt
  • Posts: 147
Re: Brush attribute
« Reply #9 on: June 05, 2015, 03:11:28 AM »

emk2012

From a quick look ;

Some of the keys in your DCL are not strings ... they should be.
//------------

(= moname "PLINE") and
(= name "PLINE")

should be type "LWPOLYLINE"

Hi Kerry
I'm truly grateful for your help.
andy.
Best regards.

andy_lee

  • Newt
  • Posts: 147
Re: Brush matchprop
« Reply #10 on: June 05, 2015, 03:36:24 AM »
Quote
Some of the keys in your DCL are not strings ... they should be.
//------------

What this mean ?

in DCL , key=scjd and key=jt , Unknown ,what this do ?

"Reverse selected " can't use .why?
« Last Edit: June 05, 2015, 03:58:15 AM by emk2012 »
andy.
Best regards.

roy_043

  • Water Moccasin
  • Posts: 1783
  • BricsCAD 18
Re: Matchprop Brush
« Reply #11 on: June 05, 2015, 04:20:00 AM »
Keys in a dcl file should be strings.
So instead of:
Code: [Select]
key = scjd;You should use:
Code: [Select]
key = "scjd";
Reverse selected works for me.

andy_lee

  • Newt
  • Posts: 147
Re: Matchprop Brush
« Reply #12 on: June 05, 2015, 04:33:12 AM »
Keys in a dcl file should be strings.
So instead of:
Code: [Select]
key = scjd;You should use:
Code: [Select]
key = "scjd";
Reverse selected works for me.

Thanks roy.
But I can't use REVERSE SELECTED , why?

« Last Edit: June 05, 2015, 06:51:40 AM by emk2012 »
andy.
Best regards.

roy_043

  • Water Moccasin
  • Posts: 1783
  • BricsCAD 18
Re: Matchprop Brush
« Reply #13 on: June 05, 2015, 08:26:54 AM »
The 'Reverse selected' toggle reverses the meaning of the toggles above it.
Assume you have select all toggles except the 'Color' toggle.
If 'Reverse' if OFF all properties except the color will be matched.
If 'Reverse' is ON only the color will be matched.

A reverse button that actually switches the toggles would have made more sense.
It may be a nice challenge for you to try to implement that...