Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Function for checking all objects between 2 points

  1. #1
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Function for checking all objects between 2 points

    Hey All

    I am attempting to make a function to check all objects between 2 points.
    it needs to check their layers to see if it is an impassable object, eg: *Wall*,*Glaz*,*Struct*.

    This is what I have so far but it is returning unpredictable data.

    Code:
    (defun ClashDetection ( pt1 pt2 )
    	(if (setq s (ssget "_F" (list pt1 pt2)))
    		(progn
    			(setq 	i 0
    					n (sslength s)
    					check nil
    			)
    			(repeat n
    				(setq 	e (ssname s i)
    						x (cdr (assoc 8 (entget e)))
    						WIP	(if (/= nil (wcmatch (strcase x) "*GENM*,*WALL*,*WALL,*GLAZ*,*GLAZ"))
    									(setq check "T")
    								)
    						i (1+ i)
    				)
    			)
    		)
    	)
    	print check
    )
    
    
    
    
    (defun c:ffs ()
    	(setq 	ptstart		(getpoint)
    			ptend		(getpoint)
    			printout	(ClashDetection ptstart ptend)
    	)
    	princ printout
    )
    Any Help would be greatly appreciated.
    Cheers
    Last edited by rkmcswain; 2014-12-18 at 12:45 PM. Reason: added [CODE] tags

  2. #2
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    Sorry all, I solved it after I posted and I cant seem to remove the thread.
    just a simple variable reset.

    here is the solution
    Code:
    (defun ClashDetection ( pt1 pt2 )
    	(setq	n		nil
    			s		nil
    			e		nil
    			x		nil
    			check	nil
    	)
    	(if (setq s (ssget "_F" (list pt1 pt2)))
    		(progn
    			(setq 	i 0
    					n (sslength s)
    			)
    			(repeat n
    				(setq 	e (ssname s i)
    						x (cdr (assoc 8 (entget e)))
    						WIP	(if (/= nil (wcmatch (strcase x) "*GENM*,*WALL*,*WALL,*GLAZ*,*GLAZ"))
    									(setq check "T")
    								)
    						i (1+ i)
    				)
    			)
    		)
    	)
    	print n
    )
    
    (defun c:ffs ()
    	(setq 	ptstart		(getpoint)
    			ptend		(getpoint)
    			printout	(ClashDetection ptstart ptend)
    	)
    	princ printout
    )
    Last edited by rkmcswain; 2014-12-18 at 12:46 PM. Reason: added [CODE] tags

  3. #3
    Mod / Salary / SM Wanderer's Avatar
    Join Date
    2001-12
    Location
    St. Louis
    Posts
    5,407
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    Quote Originally Posted by LSElite View Post
    Sorry all, I solved it after I posted and I cant seem to remove the thread.
    just a simple variable reset.

    here is the solution
    Thanks for taking the time to post your solution. Maybe someone will see it in the future and benefit from it, too.
    Melanie Stone
    @MistresDorkness

    Archibus, FMS/FMInteract and AutoCAD Expert (I use BricsCAD, Revit, Tandem, and Planon, too)
    Technical Editor
    not all those who wander are lost

  4. #4
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    FYI the ssget function has the ability to filter layers.

    Another way to write the function would be to use the ssget filtering and sslength



    Code:
    (defun ClashDetection ( lstPoint1 lstPoint2 )
     (sslength (ssget "_f" (list lstPoint1 lstPoint2)
                           (list (cons 8 "*GENM*,*WALL*,*WALL,*GLAZ*,*GLAZ"))
               )
     )
    )
    AutomateCAD

  5. #5
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    That is groovy, I love it when you can refine your code.
    Cheers Peter.

  6. #6
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    Peters solution works well but I am finding that it will not step into objects such as blocks, dynamic blocks or xrefs.
    Ideally I would like it to look through all objects between 2 points and the objects within them.
    Does anyone have any ideas?

  7. #7
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    Quote Originally Posted by LSElite View Post
    Peters solution works well but I am finding that it will not step into objects such as blocks, dynamic blocks or xrefs.
    Ideally I would like it to look through all objects between 2 points and the objects within them.
    Does anyone have any ideas?
    LSElite, have you ever seen this post :
    http://forums.augi.com/showthread.ph...ification&p=#8

    HTH, M.R.

  8. #8
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    Cheers mate, I forgot I had another thread floating around somewhere.
    The code in your link is the one I am using and it for some reason still does not seem to reach into any objects.
    It also seems to trip up when there are acceptable elements over the top of unacceptable elements.

    The blue elements are hose runs and the grey elements are walls.
    I've circled the issue.
    ClashDetection.JPG

    If all elements are bursted it works beautifully though, it just seems to be these final tweaks.
    ClashDetection2.JPG

  9. #9
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    It is possible to translate from the world coordinate system to a blocks coordinate system.

    It should be straight forward to translate the two points into the selected blocks using recursion and find objects within the blocks.

    P=
    AutomateCAD

  10. #10
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Re: Function for checking all objects between 2 points

    Sounds like I am in over my head, can you recommend any good reference material I can use as a guide?

Page 1 of 2 12 LastLast

Similar Threads

  1. 2013: Picking end points on 3d objects
    By balcomwoodworks164944 in forum AutoCAD 3D (2007 and above)
    Replies: 3
    Last Post: 2014-11-17, 11:40 PM
  2. 2012 JPEG Resolution in function "Points of view report"
    By the_djodjo351945 in forum NavisWorks - General
    Replies: 3
    Last Post: 2013-01-21, 03:29 PM
  3. Replies: 0
    Last Post: 2007-04-27, 08:14 PM
  4. Checking for Duplicate AEC Objects
    By pdavis in forum ACA General
    Replies: 7
    Last Post: 2007-02-20, 06:57 PM
  5. Stretch Objects between two points
    By ReachAndre in forum AutoLISP
    Replies: 4
    Last Post: 2006-09-27, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •