Results 1 to 3 of 3

Thread: Change the units of dimensions from Metric to English

  1. #1
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Question Change the units of dimensions from Metric to English

    Does anyone have a lisp routine that will change the units of a dimension
    from metric to english units while converting the specified tolerance?

    I can use dimension styles, however, switching between them results
    in a lost tolerance. See example:

    I have 100+/-2

    changing the dimstyle I get

    3.93 without a tolerance.

    Is it possible to get 3.93 +/-0.08?

    Are there too many variables that the routine would have to manipulate?

  2. #2
    I could stop if I wanted to
    Join Date
    2003-11
    Posts
    277
    Login to Give a bone
    0

    Default Re: Change the units of dimensions from Metric to English

    Hi Robert,
    I'm not sure this code would help you,but for sample if you want create dimension,and look at this code to evaluated.
    Code:
    ; smd is stand for Sample Making Dimension
    ;        Design by  : Adesu <Ade Suharna>
    ;        Email      : mteybid@yuasabattery.co.id
    ;        Homepage   : http://www.yuasa-battery.co.id
    ;        Create     : 2 August 2004
    ;        Program no.: 45/08/2004
    ;        Edit by    : Adesu  03/08/2004  not recorded
    (defun dtr (a)
      (* pi (/ a 180.0))
      )
    
    (defun c:smd (/ olddimtxt olddimdec olddimtad olddimse1
    	     olddimse2 olddimexe olddimexo olddimgap 
    	     olddimtih p1 p2 p3 p4 ent3 ent4)
      (setq oldosmode (getvar "osmode"))                   ; get osmode setting
      (setvar "osmode" 0)                                  ; osmode set to 0
      (setq oldcmdecho (getvar "cmdecho"))                 ; get cmdecho setting
      (setvar "cmdecho" 0)                                 ; cmdecho set to 0  
      (vl-load-com)
      (setq olddimtxt (getvar "dimtxt")
    	olddimdec (getvar "dimdec")
    	olddimtad (getvar "dimtad")
    	olddimse1 (getvar "dimse1")
    	olddimse2 (getvar "dimse2")   
            olddimexe (getvar "dimexe")
    	olddimexo (getvar "dimexo")
    	olddimgap (getvar "dimgap")
    	olddimtih (getvar "dimtih")
    	oldfilletrad (getvar "filletrad")
    	olddimblk (getvar "dimblk")
    	olddimasz (getvar "dimasz")
    	olddimlim (getvar "dimlim")
    	olddimtm (getvar "dimtm")	
    	olddimtol (getvar "dimtol")
    	olddimtdec (getvar "dimtdec"))
      (setvar "dimtxt" 1)                                   ; set text height
      (setvar "dimdec" 2)                                   ; set decimal presicion
      (setvar "dimtad" 1)                                   ; set vertical position
      (setvar "dimse1" 0)                                   ; set Suppresses display of the first extension line
      (setvar "dimse2" 0)                                   ; set Suppresses display of the second extension line
      (setvar "dimexe" 1)                                   ; set Specifies how far to extend the extension line beyond the dimension line
      (setvar "dimexo" 1)                                   ; set Specifies how far extension lines are offset from origin points
      (setvar "dimgap" 1)                                   ; set Sets the distance around the dimension text when the dimension line breaks to accommodate dimension text
      (setvar "dimtih" 0)                                   ; set Controls the position of dimension text inside the extension lines for all dimension types except ordinate
      (setvar "filletrad" 3)                                ; set radius of follet
      (setvar "dimblk" "_open")                             ; set style arrow
      (setvar "dimasz" 1)                                   ; set arrow size
      (setvar "dimlim" 1)                                   ; set limit  
      (setvar "dimtm" 5)                                    ; set lower limit
      (setvar "dimtol" 1)                                   ; set limit
      (setvar "dimtdec" 0)                                  ; set limit presicion
      (setq p1 (list 0 0)
    	p2 (list 10 0)
    	p3 (list 10 15)
    	p4 (list 0 15))
     (command "_line" p1 p2 p3 p4 "c" "")
      (setq ent3 (list 15 15)
    	ent4 (list 7.5 20)
    	ent5 (polar p1 (dtr 0) 5)
    	ent6 (polar p1 (dtr 90) 5)
    	ent7 (polar p1 (dtr 0) 3)
    	ent7a (polar ent7 (dtr 90) 3)
    	ent8 (polar ent7a (dtr 225) 3)
    	ent9 (polar ent7a (dtr 225) 10))                       
     (command "_dimlinear" p2 p3 "v" ent3 "")
     (command "_dimlinear" p4 p3 "h" ent4 "")
     (command "_fillet" ent5 ent6 "")
     (command "_dimradius" ent8 ent9 "") 
      (setvar "osmode" oldosmode)                            ; return setting
      (setvar "cmdecho" oldcmdecho)                          
      (setvar "dimtxt" olddimtxt)
      (setvar "dimdec" olddimdec)                           
      (setvar "dimtad" olddimtad)                          
      (setvar "dimse1" olddimse1)
      (setvar "dimse2" olddimse2)                           
      (setvar "dimexe" olddimexe)                          
      (setvar "dimexo" olddimexo)
      (setvar "dimgap" olddimgap)
      (setvar "dimtih" olddimtih)
      (setvar "dimblk" olddimblk)
      (setvar "dimasz" olddimasz)
      (setvar "dimlim" olddimlim)
      (setvar "dimtm" olddimtm)
      (setvar "dimtol" olddimtm)
      (setvar "dimtdec" olddimtdec)  
    (princ)
      (command "_redraw")
      )

    Quote Originally Posted by Robert.Hall
    Does anyone have a lisp routine that will change the units of a dimension
    from metric to english units while converting the specified tolerance?

    I can use dimension styles, however, switching between them results
    in a lost tolerance. See example:

    I have 100+/-2

    changing the dimstyle I get

    3.93 without a tolerance.

    Is it possible to get 3.93 +/-0.08?

    Are there too many variables that the routine would have to manipulate?

  3. #3
    Certifiable AUGI Addict robert.1.hall72202's Avatar
    Join Date
    2004-07
    Location
    Detroit Michigan
    Posts
    2,508
    Login to Give a bone
    0

    Default Re: Change the units of dimensions from Metric to English

    That creates a pre-dimensioned object.
    I have a couple routines that do something similar.
    I do see how the tolerance has been added.
    I should have my routines do the same.

    I don't think that is what I am after in this
    particular post, however, that gives me
    a few other ideas.

Similar Threads

  1. Change Units From imperial to metric
    By GrD in forum AutoCAD Structural Detailing
    Replies: 2
    Last Post: 2013-10-12, 02:14 PM
  2. Metric/English Dimensions
    By chris.spenski in forum Revit - Platform
    Replies: 3
    Last Post: 2011-07-08, 09:06 PM
  3. Grid in English units, CL elevation in Metric?
    By SRBalliet in forum AutoCAD Civil 3D - Sections
    Replies: 1
    Last Post: 2008-06-17, 03:18 PM
  4. Area in metric from English units drawing
    By robert.1.hall72202 in forum AutoLISP
    Replies: 24
    Last Post: 2006-01-30, 08:58 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
  •