Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/26/2025 in Posts

  1. I have got it working now, I changed (if (> (length tls) 2) to (if (> (length tls) 1) and that seems to do the trick! Thanks for your help! Your routine will save me a lot of time.
    1 point
  2. Just a comment like @Lee Mac when doing ssget with filters "F" "CP" "WP" it is always a good idea to add the last point to the list again this has the effect of a closed group of points. (setq plent (entsel "\nPick rectang")) (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) (setq co-ord (cons (last co-ord) co-ord))
    1 point
  3. Ok once you make a viewport you need to zoom to a point inside Mspace, you can set the scale of the viewport also in this 2 step process. (command "zoom" "C" (getpoint '\PIck center point ") 100) (command "zoom" (strcat (rtos scale 2 2) "XP) When you zoom C it sets the viewport centre point, using scaleXP ie 4XP resets the viewport scale but keeps the centre point. If you have rectangs in Model space then yes can make layouts that match. You need to start with something like this. I have made rectangs that follow a pline. The software finds them and makes layouts. Another version allows user placement, both methods can be used then layouts made. Happy to discuss how its done, are you metric or imperial ? There is some behind the scenes set up.
    1 point
  4. In any case, it could still be simplified a bit further. But leaving aside Maahee's choice of doing it with 'foreach'.... (defun c:myDimAlign (/ x e p f) (if (and (setq e (car (entsel "\nSelect any LWpolyline..."))) (= (cdr (assoc 0 (setq x (entget e)))) "LWPOLYLINE") ) (while (setq f (cdr (assoc 10 (setq x (cdr (member (setq p (assoc 10 x)) x)))))) (command "DIMALIGNED" (cdr p) f "@5<180") ) ) )
    1 point
  5. Alternatively from here: ;; Project Point onto Line - Lee Mac ;; Projects pt onto the line defined by p1,p2 (defun LM:ProjectPointToLine ( pt p1 p2 / nm ) (setq nm (mapcar '- p2 p1) p1 (trans p1 0 nm) pt (trans pt 0 nm) ) (trans (list (car p1) (cadr p1) (caddr pt)) nm 0) ) Which could also be written: (defun LM:projectpointtoline ( pnt pt1 pt2 ) ( (lambda ( vec ) (trans (reverse (cons (caddr (trans pnt 0 vec)) (cdr (reverse (trans pt1 0 vec))))) vec 0)) (mapcar '- pt1 pt2) ) ) For your case: (setq xy1 '(1.0 1.0 0.0) xy2 '(2.0 3.0 0.0) xy3 '(1.5 1.6 0.0) xy4 (LM:projectpointtoline xy3 xy1 xy2) )
    1 point
×
×
  • Create New...