Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/23/2021 in all areas

  1. Amongst several different ways of drawing a perpendicular from a line, the one I use most of the time is to have Polar Tracking permanently on. As long as it is set up to measure the Polar angle relative to last segment, then I start from the line using Nearest OS, and then the guide lines show where perpendicular is.
    1 point
  2. I've seen this behavior when attributes share a name. Someone made a graphic scale and named all the attributes SCALE, even though the values need to be (scale), (scale x 2), (scale x 4), (scale x 1/2), etc. If you change any one of the values, they all change, so the scale is useless. The solution is to give them distinct names. I don't know if that applies to fields, but it's worth a look.
    1 point
  3. For Civil 3D users there's a LINEPERPENDICULAR command for doing just that. Lee Mac's Cursor Rotate lisp makes this easy though. http://www.lee-mac.com/cursorrotate.html Pick the line to set snap angle and set Grade to 0 after you're done.
    1 point
  4. Try plotting with the latest DWG TrueView. If that doesn't work, something is amiss on your computer and not AutoCAD 2017. You should try to post the file here as well.
    1 point
  5. I noticed that the object is changed to a vla-object in the vltx variable. Just to be change it back to an ename a few lines below. Guess this would be a small efficiency improvement
    1 point
  6. Use the UCS command to align the UCS with the line and then use ortho F8
    1 point
  7. Try osnap set to perp only osmode 128 then can Line Near and a perp line should then appear and you can enter pick length etc. A lisp would do this as well. May also be able to use Cal.
    1 point
  8. @confutatis Whoa ! woohoo ! , Your code works like charm So, happy with the result. I was like doing all this manually and frustrated so much, It was so tedious work, and you just made my day. Can't thank you enough! Today, Got this file to process which I'm attaching. There were more data on the line, when I use your code its not working. I wonder why it's not working?
    1 point
  9. Here is a simple function implementing a ray-casting algorithm. However, note that this function does not test whether the ray 'grazes' a vertex - for example, in the following image the function will incorrectly determine the point as being outside the polyline since the ray intersects the boundary an even number of times.
    1 point
  10. Here is my method: [color=GREEN];; Point Inside-p - Lee Mac[/color] [color=GREEN];; Utilises a ray-casting algorithm to determine whether a[/color] [color=GREEN];; given point (WCS) resides within a supplied object.[/color] ([color=BLUE]defun[/color] LM:PointInside-p ( pt obj [color=BLUE]/[/color] lst ray ) ([color=BLUE]setq[/color] lst ([color=BLUE]vlax-invoke[/color] ([color=BLUE]setq[/color] ray ([color=BLUE]vla-addray[/color] ([color=BLUE]vla-objectidtoobject[/color] ([color=BLUE]vla-get-document[/color] obj) ([color=BLUE]vla-get-ownerid[/color] obj)) ([color=BLUE]vlax-3D-point[/color] pt) ([color=BLUE]vlax-3D-point[/color] ([color=BLUE]mapcar[/color] '[color=BLUE]+[/color] pt '(1.0 0.0 0.0))) ) ) 'intersectwith obj [color=BLUE]acextendnone[/color] ) ) ([color=BLUE]vla-delete[/color] ray) ([color=BLUE]=[/color] 1 ([color=BLUE]logand[/color] 1 ([color=BLUE]length[/color] lst))) ) To test: ([color=BLUE]defun[/color] c:test ( [color=BLUE]/[/color] ent obj pnt ) ([color=BLUE]if[/color] ([color=BLUE]setq[/color] ent ([color=BLUE]car[/color] ([color=BLUE]entsel[/color] [color=MAROON]"\nSelect Polyline: "[/color]))) ([color=BLUE]if[/color] ([color=BLUE]vlax-method-applicable-p[/color] ([color=BLUE]setq[/color] obj ([color=BLUE]vlax-ename->vla-object[/color] ent)) 'intersectwith) ([color=BLUE]while[/color] ([color=BLUE]setq[/color] pnt ([color=BLUE]getpoint[/color] [color=MAROON]"\nPick Point: "[/color])) ([color=BLUE]if[/color] (LM:PointInside-p ([color=BLUE]trans[/color] pnt 1 0) obj) ([color=BLUE]alert[/color] [color=MAROON]"Point is INSIDE"[/color]) ([color=BLUE]alert[/color] [color=MAROON]"Point is OUTSIDE"[/color]) ) ) ([color=BLUE]princ[/color] [color=MAROON]"\nInvalid Object selected."[/color]) ) ) ([color=BLUE]princ[/color]) ) ([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color]) More rigorous testing may be required to account for the case in which the projected ray is parallel to the intersecting edge. But the above will suffice for the majority of general applications.
    1 point
  11. You may adapt this for your code: (defun c:TestPick( / refEntity thePoint ) (setq refEntity (entlast)) (setq thePoint (getpoint "\nPick a point:")) (command "_BOUNDARY" thePoint "") (if (equal refEntity (entlast)) (prompt "\nPicked outside!") (progn (prompt "\nPicked inside!") (entdel (entlast)) ) ) (princ) )
    1 point
  12. Try this .... (defun c:Test (/ p1 p2 gr) ;;;;; Tharwat 28. June. 2012 ;;;;; (if (and (setq p1 (getpoint "\n Specify point :")) (setq p2 (getcorner p1 "\n Corner :")) ) (while (eq (car (setq gr (grread t 15 1))) 5) (redraw) (foreach n '((0.5 0.5 0.0) (-0.5 0.5 0.0)(-0.5 -0.5 0.0)(0.5 -0.5 0.0)) (grdraw (cadr gr) (mapcar '+ (mapcar (function (lambda (x) (* x (/ (getvar "VIEWSIZE") 25.)))) (trans n 1 0)) (cadr gr) ) 1 0 ) ) (if (and (< (car p1) (car (cadr gr))) (> (car p2) (car (cadr gr))) (> (cadr p1) (cadr (cadr gr))) (< (cadr p2) (cadr (cadr gr))) ) (princ "\n inside ...... ") (princ "\n outside ..... ") ) ) ) (redraw) (princ) )
    1 point
  13. Command: (vl-catch-all-apply 'ptinsideent (list pt ent)) # - pt lies on ent -if you want to return T (pt lies on ent and may not be inside or outside ent) use : (vl-catch-all-error-p (vl-catch-all-apply 'ptinsideent (list pt ent))) Command: (vl-catch-all-apply 'ptinsideent (list pt ent)) T - pt is inside ent Command: (vl-catch-all-apply 'ptinsideent (list pt ent)) nil - pt is outside ent (if (vl-catch-all-error-p (vl-catch-all-apply 'ptinsideent (list pt ent))) (prompt "\nPoint is on entity") (if (ptisideent pt ent) (prompt "\nPoint is inside entity") (prompt "\nPoint is outside entity") ) )
    1 point
  14. (defun GroupByNum ( lst n / r) (if lst (cons (reverse (repeat n (setq r (cons (car lst) r) lst (cdr lst)) r)) (GroupByNum lst n) ) ) ) (defun ptonline ( pt pt1 pt2 / vec12 vec1p d result ) (setq vec12 (mapcar '- pt2 pt1)) (setq vec12 (reverse (cdr (reverse vec12)))) (setq vec1p (mapcar '- pt pt1)) (setq vec1p (reverse (cdr (reverse vec1p)))) (setq vec2p (mapcar '- pt2 pt)) (setq vec2p (reverse (cdr (reverse vec2p)))) (setq d (distance '(0.0 0.0) vec12) d1 (distance '(0.0 0.0) vec1p) d2 (distance '(0.0 0.0) vec2p)) (if (equal d (+ d1 d2) 1e- (setq result T) (setq result nil)) result ) (defun ptinsideent ( pt ent / msp ptt xlin int k kk tst result ) (vl-load-com) (setq msp (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) (setq ptt (vlax-curve-getclosestpointto ent pt)) (setq xlin (vla-addxline msp (vlax-3d-point pt) (vlax-3d-point ptt))) (setq int (GroupByNum (vlax-invoke (if (eq (type ent) 'ENAME) (vlax-ename->vla-object ent)) 'intersectwith xlin acExtendBoth) 3)) (setq int (vl-sort int '(lambda (a b) (< (vlax-curve-getparamatpoint xlin a) (vlax-curve-getparamatpoint xlin b))))) (setq k 0) (while (< (setq k (1+ k)) (length int)) (if (and (eq (rem k 2) 1) (ptonline pt (nth (- k 1) int) (nth k int))) (setq tst (cons T tst)) (setq tst (cons nil tst))) ) (setq tst (reverse tst)) (setq k 0) (mapcar '(lambda (x) (setq k (1+ k)) (if (eq x T) (setq kk k))) tst) (vla-delete xlin) (if kk (if (eq (rem kk 2) 1) (setq result T) (setq result nil)) (setq result nil) ) result ) (ptinsideent pt ent) => T or nil M.R.
    1 point
×
×
  • Create New...