Get Extrude Length in 3D Solids

Discussion in 'AutoCAD' started by Cristian Leon, Oct 28, 2004.

  1. Hello:

    I'm trying to get the length of a 3D Solid made with a Extrude. how can i get it with a Lisp program?

    Cristian Leon
    Chile
     
    Cristian Leon, Oct 28, 2004
    #1
  2. Cristian Leon

    mataeux Guest

    is the 3dsolid guaranteed to be oriented the same way in 3d space?

    if you are dealing with flat regions extruded straight upward, just get the
    bounding box and use the z value.

    i guess if you say 'get the length of ' you are dealing with objects
    extruded horizontally in any direction. so...

    if you're dealing strictly with circles or ellipses that have been extruded,
    then its simple to extract the only two "point" values from the sat data and
    compute the distance between

    but ! if you need to include irregular shapes that have been extruded or if
    the 3d solid has been sliced or subtracted in the least, then a bit more
    computing is required.
     
    mataeux, Oct 28, 2004
    #2
  3. Cristian Leon

    Don Butler Guest

    I'm playing with it too.
    Here's the direction I'm heading. Be careful, no error checking.
    It works on the extruded solids I have here.

    (defun c:prac
    (/ lis linefound line ent file lin nums lis1 lis2 pt1 pt2)
    (setvar "expert" 5)
    (setq ent (car (entsel)))
    (command "acisout" ent "" "c:\\temp2")
    (setq file (open "c:\\temp2.sat" "r"))
    (while (setq line (read-line file))
    (if line
    (if (or linefound (wcmatch (strcase line t) "point*"))
    (progn (setq linefound t) (setq lis (cons line lis)))
    )
    )
    )
    (close file)
    (setq lin (parse (apply 'strcat lis) " "))
    (setq
    nums (vl-remove-if-not
    '(lambda (x) (or (= (type (read x)) 'real) (= (read x) 0)))
    lin
    )
    )
    (setq lis1 (list (nth 0 nums) (nth 1 nums) (nth 2 nums)))
    (setq lis2 (list (nth 3 nums) (nth 4 nums) (nth 5 nums)))
    (setq pt1 (mapcar 'atof lis1))
    (setq pt2 (mapcar 'atof lis2))
    (distance pt1 pt2)
    )

    ;;Necessary parsing Sub'r
    ;;Luis and Marc'Antonio, Eric Schneider, John Uhden
    (defun parse (str pat / i j n lst)
    (cond
    ((/= (type str)(type pat) 'STR))
    ((= str pat)'(""))
    (T
    (setq i 0 n (strlen pat))
    (while (setq j (vl-string-search pat str i))
    (setq lst (cons (substr str (1+ i)(- j i)) lst)
    i (+ j n)
    )
    )
    (reverse (cons (substr str (1+ i)) lst))
    )
    )
    )

    Don
     
    Don Butler, Oct 28, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.