Lt Dan's legs Posted October 21, 2010 Share Posted October 21, 2010 how would I go about doing that? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 21, 2010 Share Posted October 21, 2010 Look into either inters or the IntersectWith method Also, do a search on here, there are buckets of examples... Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 21, 2010 Share Posted October 21, 2010 buckets of examples...LoL, buckets. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 21, 2010 Share Posted October 21, 2010 You don't have that expression in America? Quote Link to comment Share on other sites More sharing options...
alanjt Posted October 21, 2010 Share Posted October 21, 2010 You don't have that expression in America? Yes. Sadly, we use less eloquent phrases, such as 'butt load'. I was really just laughing at the visual. Not sure why I responded - I hang out in these forums far too much. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 21, 2010 Share Posted October 21, 2010 I hang out in these forums far too much. Lol don't we all Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted October 21, 2010 Author Share Posted October 21, 2010 Thanks Lee. (defun c:test (/ p1 p2 ss #) (setq p1 (getpoint "\nFirst point: ") p2 (getpoint p1 "\nSecond point: ") ss (ssget "F" (list p1 p2))) (repeat (setq # (sslength ss)) (setq ent (entget (ssname ss (setq # (1- #))))) (entmake (list (cons 0 "point") (cons 10 (inters p1 p2 (cdr (assoc 10 ent))(cdr (assoc 11 ent)))) ) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 21, 2010 Share Posted October 21, 2010 I think these have been posted here before, but hopefully these will help: ;;--------------=={ Get Intersections in SS }==---------------;; ;; ;; ;; Returns a list of all points of intersection between ;; ;; objects in a selection set ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; ss - SelectionSet ;; ;;------------------------------------------------------------;; ;; Returns: List of intersection points, or nil ;; ;;------------------------------------------------------------;; (defun LM:GetIntersectionsinSS ( ss ) (vl-load-com) ;; © Lee Mac 2010 ( (lambda ( i / j a b iLst ) (while (not (minusp (setq j (1- i) i (1- i)))) (setq a (vlax-ename->vla-object (ssname ss i))) (while (not (minusp (setq j (1- j)))) (setq b (vlax-ename->vla-object (ssname ss j))) (setq iLst (append iLst (LM:GroupByNum (vlax-invoke a 'IntersectWith b acExtendNone) 3))) ) ) iLst ) (sslength ss) ) ) ;;-----------------=={ Group by Number }==--------------------;; ;; ;; ;; Groups a list into a list of lists, each of length 'n' ;; ;;------------------------------------------------------------;; ;; Author: Lee McDonnell, 2010 ;; ;; ;; ;; Copyright © 2010 by Lee McDonnell, All Rights Reserved. ;; ;; Contact: Lee Mac @ TheSwamp.org, CADTutor.net ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; l - List to process ;; ;; n - Number of elements by which to group ;; ;;------------------------------------------------------------;; ;; Returns: List of lists, each of length 'n' ;; ;;------------------------------------------------------------;; (defun LM:GroupByNum ( l n / a b ) ;; © Lee Mac 2010 (while l ( (lambda ( i ) (while (< 0 i) (setq a (cons (car l) a) l (cdr l) i (1- i)) ) (setq b (cons (reverse a) b) a nil) ) n ) ) (reverse b) ) ;; Test Function (defun c:test ( / ss x ) (vl-load-com) (if (setq ss (ssget)) (foreach x (LM:GetIntersectionsinSS ss) (entmakex (list (cons 0 "POINT") (cons 10 x))) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted November 3, 2010 Author Share Posted November 3, 2010 I wanted to revisit this just to use grvecs and grread (defun c:ins (/ *error* p1 p2 ss ent id ins lst) (defun *error* (msg) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **")) ) (redraw) (princ) ) (setq p1 (getpoint "\nSpecify first point: ")) (prompt "\nSpecify second point: ") (while (eq 5 (car (setq p2 (grread 't 13 0)))) (setq lst nil) (redraw) (grdraw p1 (cadr p2) 6 1) (if (setq ss (ssget "_f" (list p1 (cadr p2)) '((0 . "line")))) (repeat (setq id (sslength ss)) (setq ent (entget (ssname ss (setq id (1- id))))) (setq lst (append (list (setq ins (inters p1 (cadr p2) (cdr (assoc 10 ent))(cdr (assoc 11 ent))))) lst)) (grvecs (list 130 (list (+ (car ins) 12)(+ (cadr ins) 12))(list (+ (car ins) -12)(+ (cadr ins) -12)) 130 (list (+ (car ins) -12)(+ (cadr ins) 12))(list (+ (car ins) 12)(+ (cadr ins) -12)))) ) ) ) (if (eq ss nil) (prompt "\n** No intersecting lines! **" ) (repeat (setq id (sslength ss)) (entmake (list (cons 0 "point") (cons 10 (nth (setq id (1- id)) lst)) ) ) ) ) (redraw) (princ) ) Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 3, 2010 Share Posted November 3, 2010 buckets of examples... LoL, buckets. You don't have that expression in America? Yes. Sadly, we use less eloquent phrases, such as 'butt load'. lmfao I hang out in these forums far too much. Lol don't we all ... ohhh, me too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.