Jump to content

nalsur8

Members
  • Content count

    48
  • Joined

  • Last visited

Community Reputation

10 Good

About nalsur8

  • Rank
    Apprentice
  • Birthday 03/09/1976

My Software

  • Main CAD Product
    AutoCAD
  • Current Product Version
    2013
  • First AutoCAD Version
    AutoCAD R14
  1. Separate/copy layer to other place by user pick point then sorting them horizontal below code not sorting horizontal.how to change the code, become horizontal (see image attached) (defun c:test1 ( / _move d ss l lst ) (vl-load-com) (defun _move ( obj p q dist ) (vla-move (setq obj (vla-copy obj)) (vlax-3D-point p) (vlax-3D-point q)) (vla-move obj (vlax-3D-point '(0. 0. 0.)) (vlax-3D-point (list dist 0. 0.))) ) (if (and (ssget "_:L") (setq p1 (getpoint "\nBase Point: ")) (setq p2 (getpoint "\nDesired Location: " p1)) (setq p1 (trans p1 1 0) p2 (trans p2 1 0)) ) (progn (vlax-for obj (setq d 10. ss (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object)))) (_move obj p1 p2 (cond ( (cdr (assoc (setq l (vla-get-layer obj)) lst)) ) ((cdr (assoc (vl-string-right-trim "D" l) lst))) ((cdr (assoc (strcat l "D") lst))) ( (setq lst (cons (cons l (setq d (- d 650.))) lst)) d ) ) ) ) (vla-delete ss) ) ) (princ) )
  2. sorry, already edit with correct format
  3. here coding command line input can help me to change using DCL dialog (defun c:bll (/ a b c d num pt ds lg p1 p2 ang p3 ht cd p4 pt5) ;; Tharwat 26. Jan. 2014 ;; ;; edited by nalsur8 11/02/2014 ;;===== add 12022014 ====== (setq os (getvar "osmode")) (setvar "osmode" 512) (if (not job#) (setq job# (getstring "\nJob Number :")) (setq job# job#) ) ;if (if (= (setq ds (getvar "dimscale")) 0.0) (setq ds 1.) ) (setq lg (+ (* ds (getvar "dimasz")) 3)) (if (not num) (setq num (getint "\n Starting Item #: ")) (setq num num) ) ;if (setq split (getstring "\nSaparate Plate? Y,N :")) (if (= split "Y") (progn (initget 1 "A B C D") (setq plate# (getkword "Plate A,B,C,D <A>:")) ) ;progn (setq plate# "") ) ;if (while (and (setq p1 (getpoint "\n Leader Start Point: ")) (setq p2 (getpoint p1 "\n Leader Ending Point: ")) ) (if (< num 10) (setq num1 "-0") (setq num1 "-") ) (setq ang (angle p1 (list (car p2) (cadr p1)))) (setq p3 (polar p2 ang lg)) (setq ht (* ds (getvar "dimtxt"))) (setq cd (/ (* (getvar "dimtxt") ds) 0.4)) (setq p4 (polar p3 ang (/ cd 2.))) (command "_.leader" "_none" p1 "_none" p2 "_none" p3 "" "" "n") (setq a (polar p4 (+ ang (* pi 0.5)) (/ cd 2.))) (setq b (polar a ang 52.)) ;(distance p2 p3))); change long slot (setq c (polar b (+ ang (* pi 1.5)) cd)) (setq d (polar c (+ pi ang) 52.)) ;(distance p2 p3))); change long slot (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1) (cons 10 a) (cons 10 b) '(42 . -1) (cons 10 c) (cons 10 d) '(42 . -1) ) ) ;;; (command "circle" p4 "d" 3"");p============= (entmakex (list '(0 . "TEXT") (cons 10 (setq pt (mapcar '(lambda (p q) (/ (+ p q) 2.)) (mapcar '(lambda (p q) (/ (+ p q) 2.)) a b) (mapcar '(lambda (p q) (/ (+ p q) 2.)) d c) ) ) ) (cons 11 pt) (cons 40 ht) (cons 1 (strcat job# num1 (itoa num) plate#)) ;edit here for text (cons 50 0.) '(41 . 1.0) (cons 7 (getvar 'textstyle)) '(71 . 0) '(72 . 4) '(73 . 0) ) ) (setq num (+ num 1)) ) ;while (setq plate# nil) ;;; );if (princ) (setvar "osmode" os) ) DCL ballon_slot : dialog{ label="Ballon Slot"; :row{ :boxed_column{label="Setting"; :column{ fixed_width=true; :row{ :text{label="Job Number (Prefix)";} :edit_box{key="jobno";fixed_width=true;} } :row{ :text{label="Plate Stage (Suffix)";} :toggle{key="?????";} :edit_box{key="suffix";fixed_width=true;} } :row{ :text{label="Start No";} :edit_box{key="start_no";fixed_width=true;} } } } :column{ :button{label="OK";key="accept";is_default=true;} :button{label="Cancel";key="cancel";is_cancel=true;} :text{} :text{} :text{} :text{} } } }
  4. Tharwat: i edited the code add same function, how to convert to DCL so user can input data from dialog (defun c:bll (/ a b c d num pt ds lg p1 p2 ang p3 ht cd p4 pt5) ;; Tharwat 26. Jan. 2014 ;; ;; edited by nalsur8 11/02/2014 ;;===== add 12022014 ====== (setq os (getvar "osmode")) ;saves current osnap settings (setvar "osmode" 512) (if(not job#) (setq job# (getstring "\nJob Number :")) (setq job# job#) );if (if (= (setq ds (getvar "dimscale")) 0.0) (setq ds 1.) ) (setq lg (+(* ds (getvar "dimasz"))3)) (if(not num) (setq num (getint "\n Starting Item #: ")) (setq num num) );if (setq split(getstring "\nSaparate Plate? Y,N :")) (if(= split "Y") (progn (initget 1 "A B C D") (setq plate# (getkword "Plate A,B,C,D <A>:")) );progn (setq plate# "") );if (while (and (setq p1 (getpoint "\n Leader Start Point: ")) (setq p2 (getpoint p1 "\n Leader Ending Point: "))) (if(< num 10) (setq num1 "-0") (setq num1 "-") ) (setq ang (angle p1 (list (car p2) (cadr p1)))) (setq p3 (polar p2 ang lg)) (setq ht (* ds (getvar "dimtxt"))) (setq cd (/ (* (getvar "dimtxt") ds) 0.4)) (setq p4 (polar p3 ang (/ cd 2.))) (command "_.leader" "_none" p1 "_none" p2 "_none" p3 "" "" "n") (setq a (polar p4 (+ ang (* pi 0.5)) (/ cd 2.))) (setq b (polar a ang 52.));(distance p2 p3))); change long slot (setq c (polar b (+ ang (* pi 1.5)) cd)) (setq d (polar c (+ pi ang)52.));(distance p2 p3))); change long slot (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") '(90 . 4) '(70 . 1) (cons 10 a) (cons 10 b) '(42 . -1) (cons 10 c) (cons 10 d) '(42 . -1) ) ) ;;; (command "circle" p4 "d" 3"");p============= (entmakex (list '(0 . "TEXT") (cons 10 (setq pt (mapcar '(lambda (p q) (/ (+ p q) 2.)) (mapcar '(lambda (p q) (/ (+ p q) 2.)) a b) (mapcar '(lambda (p q) (/ (+ p q) 2.)) d c) ) ) ) (cons 11 pt) (cons 40 ht) (cons 1 (strcat job# num1(itoa num)plate#));edit here for text (cons 50 0.) '(41 . 1.0) (cons 7 (getvar 'textstyle)) '(71 . 0) '(72 . 4) '(73 . 0) ) ) (setq num (+ num 1)) );while (setq plate# nil) ;;; );if (princ) (setvar "osmode" os) ) DCL code ballon_slot : dialog{ label="Ballon Slot"; :row{ :boxed_column{label="Setting"; :column{ fixed_width=true; :row{ :text{label="Job Number (Prefix)";} :edit_box{key="jobno";fixed_width=true;} } :row{ :text{label="Plate Stage (Suffix)";} :toggle{key="?????";} :edit_box{key="suffix";fixed_width=true;} } :row{ :text{label="Start No";} :edit_box{key="start_no";fixed_width=true;} } } } :column{ :button{label="OK";key="accept";is_default=true;} :button{label="Cancel";key="cancel";is_cancel=true;} :text{} :text{} :text{} :text{} } } }
  5. BIGAL: never use/try, any sample of lisp..
  6. any lisps programs similar like command Part Reference (autocad mechanical 2013) and other lisp to list out the block reference as table (BOM) thank you
  7. thanks Tharwat, your code is what i'm looking
  8. Tharwat: Thanks about the code, my profile already update.. Program from Lee-Mac very usefull to use it but it's no have for Leader option, if have user can choose on/off if they want to attach the leader, hope Lee-Mac can update to add some option
  9. hi, help/guide me how to change the circle to slot (defun C:bl (/ ds lg pt1 pt2 ang pt3 ht cd pt4 pt5 os dr tx) (command "undo" "m") (setq os (getvar "osmode")) (setvar "osmode" 0) (setq ds (getvar "dimscale")) (if (= ds 0.0) (setq ds 1)) (setq lg (* ds (getvar "dimasz"))) (setq pt1 (getpoint "\nLeader Start Point: ")) (setq pt2 (getpoint pt1 "\nLeader Ending Point: ")) (setq ang (angle pt1 (list (car pt2) (cadr pt1)))) (setq pt3 (polar pt2 ang lg)) (if (not num) (setq num (getint "\nStarting Item #: ")) (setq num (+ num 1))) (setq ht (* ds (getvar "dimtxt"))) (setq cd (/ (* (getvar "dimtxt") ds) 0.4)) (setq pt4 (polar pt3 ang (/ cd 2))) (COMMAND "leader" pt1 pt2 pt3 "" "" "n") (command "circle" "2p" pt3 (polar pt3 ang cd)) (command "text" "m" pt4 ht "0" num) (setvar "osmode" os) )
  10. Marko Ribar, TQ tested with acad2002 with no problem, i just add code for *error* trap when user press ESC
  11. Alenjandros85, Thank for your code, it's usefull too.. but it's not what i mean marko_ribar, Thank the code it's what i mean and thank again to modify the code for me
  12. hi, i don't want to delete or remove the picked line, i just want break the point, so later i can change the remain line to hidden or change color, if use trim command the picked line will gone
×