asos2000 Posted February 23, 2010 Author Posted February 23, 2010 Lee I edited your routine to mach the company standards But I want some help in - How to append a string EC-22- with and argument Dwgscl (setq DwgScl (getreal "\n What is Drawing Scale: 1:") StyleName EC-22-DwgScl DimName EC-DwgScl TextHeight (* DwgScl 2.2)) - How to restore OSMODE if hit ESC or enter Is this code correct? (setq *error* TERR$) (setvar "osmode" OldOS) The full routine with changes (Blue color parts which i added) ;To add the vertical ad horizantal dimensions ;which shoing the relation between columns and axes (defun c:coldim (/ *error* DwgScl P1 P2 P3 P4 SPC TXT UFLAG) (vl-load-com) (defun *error* (msg) (and uFlag (vla-EndUndoMark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) [color=blue](setq OldOS (getvar "osmode"))[/color] [color=blue] (setvar "osmode" 33)[/color] [color=blue] (setq DwgScl (getreal "\n What is Drawing Scale: 1:")[/color] [color=blue]StyleName EC-22-DwgScl[/color] [color=blue]DimName EC-DwgScl[/color] [color=blue]TextHeight (* DwgScl 2.2))[/color] [color=blue] (command "-style" StyleName "romans.shx" TextHeight "08" "0" "n" "n" "n"[/color] [color=blue] "-dimstyle" "save" DimName)[/color] [color=blue] (setvar "DIMALTF" 25.4[/color] [color=blue] "DIMALTTD" 2[/color] [color=blue] "DIMASZ" (* 0.2 DwgScl)[/color] [color=blue] "DIMBLK1" oblique[/color] [color=blue] "DIMBLK2" oblique[/color] [color=blue] "DIMCEN" 0[/color] [color=blue] "DIMCLRD" 8[/color] [color=blue] "DIMCLRE" 8[/color] [color=blue] "DIMCLRT" 10[/color] [color=blue] "DIMDEC" 0[/color] [color=blue] "DIMDLE" (* 1 DwgScl)[/color] [color=blue] "DIMDLI" 8[/color] [color=blue] "DIMDSEP" .[/color] [color=blue] "DIMEXE" (* 1 DwgScl)[/color] [color=blue] "DIMEXO" (* 3 DwgScl)[/color] [color=blue] "DIMGAP" (* 1 DwgScl)[/color] [color=blue] "DIMLDRBLK" ClosedFilled[/color] [color=blue] "DIMSAH" On[/color] [color=blue] "DIMTDEC" 0[/color] [color=blue] "DIMTIX" On[/color] [color=blue] "DIMTMOVE" 1[/color] [color=blue] "DIMTOLJ" 1[/color] [color=blue] "DIMTXT" 12[/color] [color=blue] "DIMTZIN" 0[/color] [color=blue] "DIMZIN" 0)[/color] (setq doc (cond (doc) ((vla-get-ActiveDocument (vlax-get-Acad-Object)))) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (while (and (setq p1 (getpoint "\nPick Axes Crossing Point: ")) (setq p2 (getpoint "\nPick Corner Point: "))) (setq uFlag (not (vla-StartUndoMark doc))) (apply (function vla-AddDimRotated) (append (list spc) (mapcar (function vlax-3D-point) (list (setq p3 (list (car p1) (cadr p2) (caddr p1))) p2 (polar p3 (angle p1 p3) (* DwgScl ))) '(0.))) (apply (function vla-AddDimRotated) (append (list spc) (mapcar (function vlax-3D-point) (list p2 (setq p4 (list (car p2) (cadr p1) (caddr p1))) (polar p4 (angle p1 p4) (* DwgScl ))) (list (/ pi 2.)))) (setq uFlag (vla-EndUndoMark doc)) ) ; while [color=blue]; Restore OSmode [/color] [color=blue] (setq *error* TERR$)[/color] [color=blue] (setvar "osmode" OldOS)[/color] [color=blue] (princ "\nProgram completed and will now restore the user settings and exit.")[/color] ) ; To add the vertical ad horizantal dimensions ; which shoing the relation between columns and axes and adds the column number (defun c:coldimtxt (/ *error* DwgScl P1 P2 P3 P4 SPC TXT UFLAG) (while (and (setq p1 (getpoint "\nPick Center Point: ")) (setq p2 (getpoint "\nPick Corner Point: ")) (/= "" (setq txt (getstring "\nColumn Number: ")))) (vla-AddText spc txt (vlax-3D-point (polar p2 (angle p1 p2) (sqrt (* 2. (* DwgScl (* DwgScl )))) (getvar "TEXTSIZE")) Quote
Lee Mac Posted February 23, 2010 Posted February 23, 2010 Use (strcat [color=red][color=black]"EC-22-" (rtos DwgScl))[/color][color=black] [/color][/color] Quote
asos2000 Posted February 25, 2010 Author Posted February 25, 2010 Lee Please read this thread HERE Quote
asos2000 Posted March 16, 2010 Author Posted March 16, 2010 I updated the lisp in rudimentary way Facing 2 problems - Restoring errors not working - The routine looks unrecognized ;To add the vertical ad horizantal dimensions ;which shoing the relation between columns and axes (defun c:coldim () (vl-load-com) (defun *error* (msg) (and uFlag (vla-EndUndoMark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq OldOS (getvar "osmode")) (setq OldDynmode (getvar "dynmode")) (setq OldDynprompt (getvar "dynprompt")) (setvar "osmode" 33) (setvar "dynmode" 1) (setvar "dynprompt" 1) (setvar "cmdecho" 0) (setq doc (cond (doc) ((vla-get-ActiveDocument (vlax-get-Acad-Object)))) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (command "_.-units" "2" "0" "1" "0" "0" "n") (command "_.-insert" "C:/EC-Menu/Blocks/EC-standards.dwg" "0,0,0" "1" "1" "0") (command "_.explode" "last") (command "_.-PURGE" "blocks" "EC-standards" "n") (initget 0 "20 25 50 100 150") (if (setq DwgScl (getkword "\nSpecify Drawing Scale [20/25/50/100/150]: 1:")) (progn (setq TxtHght (* 3.0 (atof DwgScl))) (setq DwgScltxt0 (strcat "EC-30-0" DwgScl)) (setq DwgScltxt (strcat "EC-30-" DwgScl)) (setq DwgSclDim0 (strcat "EC-0" DwgScl)) (setq DwgSclDim (strcat "EC-" DwgScl)) (if (> 3 (strlen DwgScl)) (progn (command "_.-dimstyle" "_Restore" DwgSclDim0) (command "_.-style" DwgScltxt0 "romans.shx" TxtHght "0.8" "0" "n" "n" "n")) (progn (command "_.-dimstyle" "_Restore" DwgSclDim) (command "_.-style" DwgScltxt "romans.shx" TxtHght "0.8" "0" "n" "n" "n"))))) (command "_.-units" "2" "2" "1" "0" "0" "n") (initget 0 "Yes No") (if (setq ColNmber (getkword "\nDo You Want to Add Column Number? [Yes/No] ")) (if (> 3 (strlen ColNmber)) (progn (while (and (setq p1 (getpoint "\nPick Axes Crossing Point: ")) (setq p2 (getpoint "\nPick Corner Point: "))) (setq uFlag (not (vla-StartUndoMark doc))) (apply (function vla-AddDimRotated) (append (list spc) (mapcar (function vlax-3D-point) (list (setq p3 (list (car p1) (cadr p2) (caddr p1))) p2 (polar p3 (angle p1 p3) (* (atof Dwgscl) ))) '(0.))) (apply (function vla-AddDimRotated) (append (list spc) (mapcar (function vlax-3D-point) (list p2 (setq p4 (list (car p2) (cadr p1) (caddr p1))) (polar p4 (angle p1 p4) (* (atof Dwgscl) ))) (list (/ pi 2.)))) (setq uFlag (vla-EndUndoMark doc)))) (progn (while (and (setq p1 (getpoint "\nPick Axes Crossing Point: ")) (setq p2 (getpoint "\nPick Corner Point: ")) (/= "" (setq txt (strcase (getstring "\nSpecify Column Number: "))))) (setq uFlag (not (vla-StartUndoMark doc))) (apply (function vla-AddDimRotated) (append (list spc) (mapcar (function vlax-3D-point) (list (setq p3 (list (car p1) (cadr p2) (caddr p1))) p2 (polar p3 (angle p1 p3) (* (atof Dwgscl) ))) '(0.))) (apply (function vla-AddDimRotated) (append (list spc) (mapcar (function vlax-3D-point) (list p2 (setq p4 (list (car p2) (cadr p1) (caddr p1))) (polar p4 (angle p1 p4) (* (atof Dwgscl) ))) (list (/ pi 2.)))) (command "clayer" "EC-TEXT-30-SCALE") (vla-AddText spc txt (vlax-3D-point (polar p2 (angle p1 p2) (sqrt (* 2. (* (atof Dwgscl) (* (atof Dwgscl) )))) TxtHght) (command "clayer" "EC-DIM-SCALE") )))) (setq uFlag (vla-EndUndoMark doc)) (setq *error* TERR$) (setvar "osmode" OldOS) (setvar "dynmode" OldDynmode) (setvar "dynprompt" OldDynprompt) (princ "\nProgram completed and will now restore the user settings and exit.")) Quote
asos2000 Posted December 23, 2010 Author Posted December 23, 2010 Is there a solving for this error Adding TRANS does not solve this error (setq p1 (trans (getpoint "\nPick Axes Crossing Point: ") 1 0)) Quote
Tharwat Posted December 23, 2010 Posted December 23, 2010 Hope you get your routine worked afterall . Example . Take a deep look. (setq pt1 (getpoint "\n First point :")) (setq pt2 (getpoint pt1 "\n Second Point :")) (setq pt3 (list (+ (car pt1) 1.)(cadr pt1))) (command "_.dimaligned" pt1 pt2 pt3) Merry Christmas guys. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.