Results 1 to 6 of 6

Thread: Dimension Lisp Help!!!!

  1. #1
    Member
    Join Date
    2008-06
    Posts
    39
    Login to Give a bone
    0

    Post Dimension Lisp Help!!!!

    I am having some problems getting this dimension routine to work. The yes button works but doesn't set the layer, the no button still asks me for the scale factor which I don't want for this option. Any clues on what I've done wrong?

    Thanks,
    Attached Files Attached Files

  2. #2
    I could stop if I wanted to
    Join Date
    2005-09
    Location
    Canada
    Posts
    214
    Login to Give a bone
    0

    Default Re: Dimension Lisp Help!!!!

    Quote Originally Posted by g_wong View Post
    I am having some problems getting this dimension routine to work. The yes button works but doesn't set the layer, the no button still asks me for the scale factor which I don't want for this option. Any clues on what I've done wrong?

    Thanks,
    whre is the

    (defun TXTSTYLEMIG () ??

  3. #3
    Member
    Join Date
    2008-06
    Posts
    39
    Login to Give a bone
    0

    Default Re: Dimension Lisp Help!!!!

    I updated it to include the code.
    Attached Files Attached Files

  4. #4
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233
    Login to Give a bone
    0

    Default Re: Dimension Lisp Help!!!!

    Give this a try. I did change some of the code and tried to comment what i changed. Let me know if it works as planned.

    Code:
    (DEFUN DIALOG ()
      (setq dcl_id (load_dialog "styles.dcl"))
      (if (not (new_dialog "styles" dcl_id)
          )
        (exit)
      )
      (action_tile
        "no"				;if cancel button pressed
        "(done_dialog 0)"                   ;close dialog, set flag 0
      )					;action_tile
      (action_tile
        "yes"				;if O.K. pressed
         "(done_dialog 1)"			;action tile, set flag 1
      )					
      (setq ans (start_dialog))			;start dialog
      (unload_dialog dcl_id)
       (if (= ans 1)				;if yes clicked then do the below
        (progn
          (scale)
          (arrow)
          (setq lay (getvar "clayer"))
          (dlay)
          (princ)
          (command "._dimradius")
          (setvar "clayer" lay)
        )
      )
      (if (= ans 0)				;if no clicked do the below
        (command "._dimradius")
      )
      (PRINC)
    )
    ;starts the command
    (defun c:rd (/)
      (setvar "cmdecho" 0)
    ;;;    (setq ruser
    ;;;	   (getstring
    ;;;	     "\nImport Standard Dimension Style [Yes/No] <No>:"
    ;;;	   )
    ;;;    )
    ;;;    (progn
    ;;;      (rdansw)
    ;;;    )
    ;;;  )
       (if (tblsearch "dimstyle" "DIM-ARW")	;if tblsearch finds the dimstyle DIM-ARW the do the below if not call the DIALOG
        (progn
          (scale)
          (arrow)
          (setq lay (getvar "clayer"))
          (dlay)
          (command "._dimradius")
          (setvar "clayer" lay)
        )
        (DIALOG)
      )
      (setvar "cmdecho" 1)
      (princ)
    )
    
    ;Scale look up
    
    (defun scale ()
    (SETQ annoscale (getstring "\nWhat is the drawing scale <1\" = 20'-0\">:"))
      (IF (= annoscale nil)
    	 (setvar "cannoscale" "1\" = 20'-0\"")
        )
      (if (= annoscale "40")
    	 (setvar "cannoscale" "1\" = 40'-0\"")
        )
      (if (= annoscale "30")
    	 (setvar "cannoscale" "1\" = 30'-0\"")
        )
      (if (= annoscale "20")
    	 (setvar "cannoscale" "1\" = 20'-0\"")
        )
      (if (= annoscale "100")
    	 (setvar "cannoscale" "1\" = 100'-0\"")
        )
      (if (= annoscale "50")
    	 (setvar "cannoscale" "1\" = 50'-0\"")
        )
      (if (= annoscale "60")
    	 (setvar "cannoscale" "1\" = 60'-0\"")
        )
      (if (= annoscale "80")
    	 (setvar "cannoscale" "1\" = 80'-0\"")
        )
      (if (or (= annoscale "1/4")
    	  (= annoscale "48"))
    	 (setvar "cannoscale" "1/4\" = 1'-0\"")
        )
      (if (or (= annoscale "1/8")
    	  (= annoscale "96"))
    	 (setvar "cannoscale" "1/8\" = 1'-0\"")
        )
      (if (= annoscale "3/16")
    	 (setvar "cannoscale" "3/16\" = 1'-0\"")
        )
      (if (= annoscale "3/8")
    	 (setvar "cannoscale" "3/8\" = 1'-0\"")
        )
      (if (or (= annoscale "1/2")
    	  (= annoscale "24"))
    	 (setvar "cannoscale" "1/2\" = 1'-0\"")
        )
      (if (= annoscale "3/4")
    	 (setvar "cannoscale" "3/4\" = 1'-0\"")
        )
      (if (= annoscale "1")
    	 (setvar "cannoscale" "1\" = 1'-0\"")
        )
      (if (= annoscale "12")
    	 (setvar "cannoscale" "1'-0\" = 1'-0\"")
        )
    )
    
    ;Dimension Creation
    
    (defun arrow ()
       (if (tblsearch "dimstyle" "DIM-ARW")
        (command "-dimstyle" "r" "DIM-ARW")
        (progn
          (if (tblsearch "style" "TEXT")
    	(setvar "dimtxsty" "TEXT")
    	(txtstyle)
          )
          (variables)
          (setvar "DIMBLK" ".")
          (setvar "DIMBLK1" ".")
          (setvar "DIMBLK2" ".")
          (setvar "DIMLDRBLK" ".")
          (command "-dimstyle" "AN"	"" "DIM-ARW" "R" "DIM-ARW")
        )
      )
    )
    
    ;Text Style Creation
    
    (defun txtstyle ()
      (command "-STYLE" "TEXT" "ARCHQUIK.shx" "A" "Y" "Y" "1/8" "" "" "" "" "")
    )
    
    ;Layer Lookup
    
    (defun dlay ()
      (if (null (tblsearch "LAYER" "L-ANNO-DIMS"))
        (PROGN
          (command "-LAYER"	    "m"		 "L-ANNO-DIMS"
    	       "c"	    "21"	 "L-ANNO-DIMS"
    	       "s"	    "L-ANNO-DIMS"	      ""
    	      )
        )
      )
      (IF (= (TBLSEARCH "LAYER" "L-ANNO-DIMS"))
        (PROGN
          (command "-LAYER" "S" "L-ANNO-DIMS" "")
        )
      )
    )

  5. #5
    Member
    Join Date
    2008-06
    Posts
    39
    Login to Give a bone
    0

    Default Re: Dimension Lisp Help!!!!

    That works however the it doesn't set the layer L-ANNO-DIMS to current for me.

  6. #6
    I could stop if I wanted to
    Join Date
    2006-07
    Posts
    233
    Login to Give a bone
    0

    Default Re: Dimension Lisp Help!!!!

    Here you go. On the tblsearch function there is not need to test it against null or itself. if tblsearch finds what it is looking for it will return T (true) and proceed, if it does not find it it will return F (False) and do the false function of the if statement.

    Code:
    (defun dlay ()
      (IF (TBLSEARCH "LAYER" "L-ANNO-DIMS")
       (progn
          (command "-LAYER" "S" "L-ANNO-DIMS" "")
       );; end of progn
       (progn
          (command "-LAYER" "m" "L-ANNO-DIMS" "c" "21"	"L-ANNO-DIMS" "s" "L-ANNO-DIMS" "")
       );; end of progn
      )
    )

Similar Threads

  1. Help me lisp Export dimension, text from a drawing
    By minhphuong.humg453254 in forum AutoLISP
    Replies: 0
    Last Post: 2013-12-02, 04:34 PM
  2. Lisp - Specify dimension line location
    By paulof in forum AutoLISP
    Replies: 4
    Last Post: 2011-09-17, 10:51 AM
  3. Lumber dimension lisp
    By tyeelaw13 in forum AutoLISP
    Replies: 1
    Last Post: 2007-01-24, 07:03 PM
  4. Replies: 15
    Last Post: 2006-11-21, 02:37 PM
  5. Dimension Lisp
    By BCrouse in forum AutoLISP
    Replies: 1
    Last Post: 2005-11-21, 04:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •