+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Nov 2008
    Posts
    49

    Embarrassed Is it possible create lisp for dimension?

    Registered forum members do not see this ad.

    Hello everyone,
    I use Qdim for dimensions but I need the totaldim.
    Is it possible to create a lisp?

    with quick dimension. tipical lisp


    Add new lisp


    Thank you
    Attached Images

  2. #2
    Senior Member
    Using
    AutoCAD 2016
    Join Date
    Jan 2012
    Posts
    160

    Default

    Why not use "DIMLINEAR" ?

  3. #3
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Nov 2008
    Posts
    49

    Default

    I think it would be very useful to work with this new lisp
    We would have dimension + total dimension.

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    titoprax yes its possible just have to do it via a lisp recording pick points and run dim twice and 2*offset for dim total. dim pt1 pt2 pt3 pt4 etc dim pt1 ptlast
    A man who never made mistakes never made anything

  5. #5
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    This is a start needs a vertical option to be added its just for testing needs some extra error checking etc. Maybe a distance offset for dims rather than pick a point. It needs to take into account the 4 sides and directions involved. Uisng a L R U D as 1st pass is one way around the problem.

    Code:
    ; Autodim a number of points in the 4 ortho directions including a total dim.
    ; By Alan H Oct 2017
    
    (defun c:adim ( / lst x y lst2 pt3 pt)
    
    (defun AH_units ()
    (SETQ ANGBASEE (GETVAR "ANGBASE"))
    (SETQ ANGDIRR (GETVAR "ANGDIR"))
    (SETQ LUNITSS (GETVAR "LUNITS"))
    (SETQ LUPRECC (GETVAR "LUPREC"))
    (SETQ AUNITSS (GETVAR "AUNITS"))
    (SETQ AUPRECC (GETVAR "AUPREC"))
    (SETVAR "LUNITS" 2)
    (SETVAR "ANGBASE" 0.0)
    (SETVAR "ANGDIR" 1)
    (SETVAR "LUPREC" 0)
    (SETVAR "AUNITS" 0)
    (SETVAR "AUPREC" 0)
    )
    (defun old_AH_units ()
    (SETVAR "LUNITS" lunitss)
    (SETVAR "ANGBASE" angbasee)
    (SETVAR "ANGDIR" angdirr)
    (SETVAR "LUPREC" luprecc)
    (SETVAR "AUNITS" aunitss)
    (SETVAR "AUPREC" auprecc)
    )
    
    (ah_units)
    
    (setq lst '())
    (while (setq pt (getpoint "Pick dim points in sequence <Cr> to stop"))
    (setq lst (cons pt lst))
    )
    
    (setq lenlst (length lst))
    (setq pt3 (getpoint (nth 0 lst) "Pick offset pt"))
    (setq ang (angle (nth 0 lst) pt3))
    
    (cond
    ((= 0.0 ang)(setq dirrvh "VER" direc "R"))
    ((= (/ pi 2) ang)(setq dirrvh "HOR" direc "U"))
    ((= pi  ang)(setq dirrvh "VER" direc "L"))
    ((= (* pi 1.5) ang)(setq dirrvh "HOR" direc "D"))
    )
    
    (if (= dirrvh "HOR")
    (progn
    (setq lst2 (vl-sort lst
    (function (lambda (e1 e2)
    (< (cadr e1) (cadr e2))
    ))))
    (setq pmax (cadr (nth (- lenlst 1) lst2)))
    (setq pmin (cadr (nth 0 lst2)))
    (if (= direc "U")
    (setq off (- (cadr pt3) pmax))
    (setq off (- (cadr pt3) pmin))
    )
    (setq pt4 (list  (cadr pt3)(+ off (cadr pt3))))
    )
    )
    (if (= dirrvh "VER")
    (progn
    (setq lst2 (vl-sort lst
    (function (lambda (e1 e2)
    (< (car e1) (car e2))
    ))))
    (setq pmax (car (nth (- lenlst 1) lst2)))
    (setq pmin (car (nth 0 lst2)))
    (if (= direc "R")
    (setq off (- (car pt3) pmax))
    (setq off (- (car pt3) pmin))
    )
    (setq pt4 (list (+ off (car pt3))(cadr pt3)))
    )
    )
    
    (old_AH_units)
    (setq x 0)
    (repeat (- (length lst) 1)
    (command "Dim" dirrvh (nth x lst) (nth  (+ x 1) lst) pt3 "" "exit" )
    (setq x (+ x 1))
    )
    (command "Dim" dirrvh (nth 0 lst) (nth (- (length lst) 1) lst) pt4 "" "exit" )
    
    (princ)
    )
    Last edited by BIGAL; 14th Oct 2017 at 04:43 am.
    A man who never made mistakes never made anything

  6. #6
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Nov 2008
    Posts
    49

    Default

    Yeeaaaaaahh¡¡¡ Thank you Bigal

  7. #7
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    Have a few ideas for the 4 directions to pick automatically. Worked out how do that so it knows left up etc just debugging code code now.
    Last edited by BIGAL; 9th Oct 2017 at 07:11 am.
    A man who never made mistakes never made anything

  8. #8
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    Registered forum members do not see this ad.

    The code above has been updated and will work for 4 directions.
    A man who never made mistakes never made anything

Similar Threads

  1. How to create rebar dimension lisp in autocad
    By Akech in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 17th Mar 2016, 06:31 am
  2. Create Dimension Style Using Visual Lisp?
    By ksperopoulos in forum AutoLISP, Visual LISP & DCL
    Replies: 23
    Last Post: 18th Feb 2016, 07:08 pm
  3. Need help !Use lisp Create text style & dimension style.
    By lucas3 in forum AutoLISP, Visual LISP & DCL
    Replies: 26
    Last Post: 18th Jan 2014, 05:53 pm
  4. dimension style create (plz chk my new lisp & how to improve)
    By autolisp in forum AutoLISP, Visual LISP & DCL
    Replies: 37
    Last Post: 31st Jul 2010, 08:01 am
  5. How to create dimension
    By abishop in forum Autodesk Inventor
    Replies: 8
    Last Post: 29th Oct 2009, 02:09 am

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