+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2014
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    1,043

    Default Dimensions Won't Line Up Properly

    I'm on to a new module for this project today and seem to be having a fit with a dimension not lining up with the others as it should. If you try this snippet of code I think you will see what I mean. The last dimension which is supposed to be in the lower right hand corner of the rectangles is not behaving as the others do, even though I wrote the code almost identically to the others which do line up.

    Code:
    (defun dtr (x)
      (* pi (/ x 180.0))
    ); end dtr function
    
    (defun c:test ()
    
      (setq oldsnap (getvar "osmode"))
      (setq oldpick (getvar "pickbox"))
      (setvar "osmode" 0)
      (setvar "pickbox" 0)
      
      (setq a 55.0
        b 45.0
        pt1 '(0.0 0.0)
        pt2 (polar pt1 0.0 b)
        pt3 (polar pt2 (dtr 270.0) a)
        pt4 (polar pt3 (dtr 180.0) b)
        ctrl1 (polar pt1 0.0 (/ b 2.0))
        ctrl2 (polar ctrl1 (dtr 90.0) 2)
        ctrl3 (polar pt1 (dtr 270.0) (/ a 2.0))
        ctrl4 (polar ctrl3 0.0 2))
    
      (command "._RECTANGLE" pt1 pt3)
      (command "._OFFSET" 0.1875 (entlast) (polar pt3 0 12) "")
      (command "._OFFSET" (- 3 (* 0.1875 2)) (entlast) (polar pt3 0 12) "")
      (command "._RECTANGLE" (polar (polar pt1 (dtr 180.0) 2) (dtr 90.0) 2) (polar (polar pt3 (dtr 0.0) 2) (dtr 270.0) 2))
      (command "._OFFSET" "1" (entlast) (polar pt1 (dtr 90.0) 12) "")
      (command "._PLINE" (polar (polar pt1 (dtr 180.0) 4) (dtr 90.0) 2)
                   (polar (polar pt1 (dtr 180.0) 2) (dtr 90.0) 4)
                   (polar (polar pt2 (dtr 0.0) 2) (dtr 90.0) 4)
                   (polar (polar pt2 (dtr 0.0) 4) (dtr 90.0) 2)
                   (polar (polar pt3 (dtr 0.0) 4) (dtr 270.0) 2)
                   (polar (polar pt3 (dtr 270.0) 4) (dtr 0.0) 2)
                   (polar (polar pt4 (dtr 180.0) 2) (dtr 270.0) 4)
                   (polar (polar pt4 (dtr 180.0) 4) (dtr 270.0) 2) "c")
      (command "._LINE" pt1 (polar (polar pt1 (dtr 180.0) 3) (dtr 90.0) 3) "")
      (command "._MIRROR" (entlast) "" ctrl1 ctrl2 "")
      (command "._MIRROR" (entlast) "" ctrl3 ctrl4 "")
      (command "._MIRROR" (entlast) "" ctrl1 ctrl2 "")
    
      (command "._ZOOM" "A")
    
      (command "._DIMLINEAR" pt1 pt2 (polar pt1 (dtr 90.0) 24))
      (command "._DIMLINEAR" pt1 (polar (polar pt1 (dtr 180.0) 4) (dtr 90.0) 2) (polar pt1 (dtr 90.0) 24))
      (command "._DIMLINEAR" pt2 (polar (polar pt2 (dtr 0.0) 4) (dtr 90.0) 2) (polar pt2 (dtr 90.0) 24))
      (command "._DIMLINEAR" pt1 pt4 (polar pt1 (dtr 180.0) 24))
      (command "._DIMLINEAR" pt1 (polar (polar pt1 (dtr 90.0) 4) (dtr 180.0) 2) (polar pt1 (dtr 180.0) 24))
      (command "._DIMLINEAR" pt4 (polar (polar pt4 (dtr 270.0) 4) (dtr 180.0) 2) (polar pt4 (dtr 180.0) 24))
      
    
      (command "._ZOOM" "A")
      (setvar "osmode" oldsnap)
      (setvar "pickbox" oldpick)
      
      (princ)
    ); end test function
    It's deja vu, all over again.

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,901

    Default

    When add dimensions via COMMAND function is safer to constrain them to desired position:
    Code:
    (command "._DIMLINEAR" pt4 (polar (polar pt4 (dtr 270.0) 4) (dtr 180.0) 2) "_V" (polar pt4 (dtr 180.0) 24))
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  3. #3
    Super Member Bill Tillman's Avatar
    Using
    AutoCAD 2014
    Join Date
    Oct 2008
    Location
    Miami, FL
    Posts
    1,043

    Default

    MSasu, thanks very kindly. I wasn't not aware that such a switch existed for dimlinear command.
    It's deja vu, all over again.

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,901

    Default

    Registered forum members do not see this ad.

    You're welcome!
    I suggest you to use it for all dimensions added that way - is much safer like this.
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

Similar Threads

  1. Dimensions next to line while drawing
    By kjaved373 in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 14th Aug 2011, 10:50 pm
  2. Drive feature dimensions with sketch dimensions?
    By Hickoz_bro in forum SolidWorks
    Replies: 4
    Last Post: 15th May 2011, 01:41 am
  3. Dimensions going all over the place after trimming a line
    By ARConnaghan in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 1
    Last Post: 22nd Mar 2011, 02:35 pm
  4. Multi-Line Dimensions
    By fifeger83 in forum AutoCAD General
    Replies: 1
    Last Post: 11th Mar 2009, 03:25 pm
  5. Vertical Dimensions Above Dim Line
    By Bill Tillman in forum AutoCAD General
    Replies: 3
    Last Post: 2nd Nov 2008, 10:57 pm

Bookmarks

Posting Permissions

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