Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/09/2023 in all areas

  1. I thought you already got an answer from another forum? Here's a quick one for fun .. prints results to the command line: (defun c:foo (/ a l n r s) (cond ((setq s (ssget '((0 . "ARC")))) ;; Add lengths to this list sorted smallest to largest (setq l (vl-sort '(1.2 1.5 2.0 2.5) '<)) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq n (vla-get-arclength (vlax-ename->vla-object e))) (if (setq n (vl-some '(lambda (x) (if (<= n x) x)) l)) (if (setq a (assoc n r)) (setq r (subst (list n (1+ (cadr a))) a r)) (setq r (cons (list n 1) r)) ) (print "NO CABLE LENGTH FOUND!") ) ) (print (vl-sort r '(lambda (r j) (< (car r) (car j))))) ) ) (princ) )
    5 points
  2. close - you're getting there. A couple of little changes then You have (setq SelObjs (ssadd)) twice in the example, it doesn't affect anything just adds clutter to the code (command "Line"..... creates 8 separate lines as you would do using the command in AutoCAD. You next line (ssadfd (entlast) SelObjs) adds the last entity created to the selection set - the line P8 to P1 (and not the whole lot) The simple fix to understand and get working would be to write a line for each segment of the lines and add these to the selection set: (command "line" p1 p2 "") (ssadd (entlast) SelObjs) (command "line" p2 p3 "") (ssadd (entlast) SelObjs) (command "line" p3 p4"") (ssadd (entlast) SelObjs) .....and so on That makes the code a bit longer and less efficient (in the scale if milliseconds and not 'get a coffee' inefficiency Another way would be to set a marker (setq latestent (entlast)) for example, create the lines as above and then loop forward from the latestent entity adding them to the selection set MHUPP gave an answer earlier today showing this method if you want to look at that A quick correction to the chprop line: (command "_.chprop" SelObjs "" "LA" "slab" "") ; set into layer. You had SelObjs as "SelObjs" .Within " " it is seen as text, and outside " " it is seen as a variable - you want to use a variable here. then of course, add an 'enter' to stop the selections with "", also the same to end the chprop command and so on... Similar things with Hatch, go through it in the command line, type in -hatch and follow the prompts, copying exactly what you type into the LISP line for the hatch and you should get there... but so close!!
    2 points
  3. This is maybe an exercise to see one copes with missing information. Looking at the diagram, it is not vital what the angle is, so one could estimate it - depending how good your eye is. Or you could take a screen snip, insert it into a drawing and trace off the angle, as in the picture below. Otherwise there is ample information to draw the exercise - just start by drawing the lines that are dimensioned and you will soon have the whole thing drawn.
    1 point
  4. 1 point
×
×
  • Create New...