Jump to content

Recommended Posts

Posted

Yea its been rough ive been up for atleast 36 hours and 4 chain-saw blades latter. But Thank God no one was hurt. But ok i tested it and it showed me the crossing entitys now what am i suppose to do with that??

Posted

Ahh, I have a better idea - how about using the points of intersection and the entity and using the break command...

Posted

hey that will work perfectly i didnt even think about that.

Posted

But how will i incorporate the points and select the rect without breaking it also?

Posted

I have this so far... but will only break when things intersect twice... only tested on lines also...

 

(defun ssinter    (ss rec / vlst i j obj1 iarr iLst ptLst)
 (setq i (length ss))
 (while (not (minusp (setq i (1- i))))
   (setq obj1 (nth i ss)
     iarr (vlax-variant-value (vla-intersectwith obj1 rec acextendnone)))
   (if    (> (vlax-safearray-get-u-bound iarr 1) 0)
         (progn
     (setq iLst (vlax-safearray->list iArr))
     (while (not (zerop (length iLst)))
       (setq ptLst (cons (list (car iLst) (cadr iLst) (caddr iLst)) ptLst)
          iLst (cdddr iLst)))
     (setq ptLst (cons (vlax-vla-object->ename obj1) ptLst)
       mainLst (cons ptLst mainLst))))))

(defun c:test  (/ rect mainLst)
 (vl-load-com)
 (setq rect (car (entsel "\nSelect Rectangle...")))
 (ssinter (mapcar 'vlax-ename->vla-object
          (vl-remove-if '(lambda (x) (eq x rect))
            (mapcar 'cadr (ssnamex (ssget "X" (list (cons 410 (getvar "CTAB"))))))))
      (vlax-ename->vla-object rect))
 (alert (vl-princ-to-string mainLst))
 (mapcar '(lambda (x) (command "_break" (list (car x) (cadr x)) (caddr x))) mainLst)
 (princ))

Posted

ok see i guess im really having trouble so how should i put this in my routine? to where it all envokes in one command?

Posted

Just replace the line that asks to select a rectangle with the entity name of your offset rectangle.

 

I.e. the variable rect should be the entity name (ename) of the rectangle you wish to trim inside. - don't worry about deleting the rectangle before running this LISP either.

Posted

Got ya. Thanks Let me see how it works.

Posted

I can't work out how to do it for multiple intersections, or a single intersection... so annoying.

 

My LISP only works if the object intersects the rectangle exactly twice... if only once, it will return and error, and if more than twice, the object won't get trimmed properly.... :(

Posted

ok Sorry It works fine. But I see that the defun C:test ok now what should i take out of your routine to put into my routine to make it one? Do you see what im saying?

Posted

Take a look at this routine for some ideas:

;;;=======================[ BreakObjects.lsp ]==============================
;;; Author: Copyright© 2006-2008 Charles Alan Butler 
;;; Contact @  www.TheSwamp.org
;;; Version:  2.1  Nov. 20,2008
;;; Purpose: Break All selected objects
;;;    permitted objects are lines, lwplines, plines, splines,
;;;    ellipse, circles & arcs 
;;;                            
;;;  Function  c:MyBreak -       DCL for selecting the routines
;;;  Function  c:BreakAll -      Break all objects selected with each other
;;;  Function  c:BreakwObject  - Break many objects with a single object
;;;  Function  c:BreakObject -   Break a single object with other objects 
;;;  Function  c:BreakWith -     Break selected objects with other selected objects
;;;  Function  c:BreakTouching - Break objects touching selected objects
;;;  Function  c:BreakSelected - Break selected objects with any objects that touch it 
;;;  Revision 1.8 Added Option for Break Gap greater than zero
;;;  NEW r1.9  c:BreakWlayer -   Break objects with objects on a layer
;;;  NEW r1.9  c:BreakWithTouching - Break touching objects with selected objects
;;;  Revision 2.0 Fixed a bug when point to break is at the end of object
;;;  Revision 2.1 Fixed another bug when point to break is at the end of object
;;;
;;;
;;;  Function  break_with  - main break function called by all others and
;;;                          returns a list of new enames, see c:BreakAll
;;;                          for an example of using the return list
;;;
;;; Requirements: objects must have the same z-value
;;; Restrictions: Does not Break objects on locked layers 
;;; Returns:  none

BreakObj21.zip

Posted

well it was a try right?

Posted
Take a look at this routine for some ideas:

;;;=======================[ BreakObjects.lsp ]==============================
;;; Author: Copyright© 2006-2008 Charles Alan Butler 
;;; Contact @  www.TheSwamp.org
;;; Version:  2.1  Nov. 20,2008
;;; Purpose: Break All selected objects
;;;    permitted objects are lines, lwplines, plines, splines,
;;;    ellipse, circles & arcs 
;;;                            
;;;  Function  c:MyBreak -       DCL for selecting the routines
;;;  Function  c:BreakAll -      Break all objects selected with each other
;;;  Function  c:BreakwObject  - Break many objects with a single object
;;;  Function  c:BreakObject -   Break a single object with other objects 
;;;  Function  c:BreakWith -     Break selected objects with other selected objects
;;;  Function  c:BreakTouching - Break objects touching selected objects
;;;  Function  c:BreakSelected - Break selected objects with any objects that touch it 
;;;  Revision 1.8 Added Option for Break Gap greater than zero
;;;  NEW r1.9  c:BreakWlayer -   Break objects with objects on a layer
;;;  NEW r1.9  c:BreakWithTouching - Break touching objects with selected objects
;;;  Revision 2.0 Fixed a bug when point to break is at the end of object
;;;  Revision 2.1 Fixed another bug when point to break is at the end of object
;;;
;;;
;;;  Function  break_with  - main break function called by all others and
;;;                          returns a list of new enames, see c:BreakAll
;;;                          for an example of using the return list
;;;
;;; Requirements: objects must have the same z-value
;;; Restrictions: Does not Break objects on locked layers 
;;; Returns:  none

 

WOWWW :shock:

 

That is one hell of a LISP CAB --- I don't even know where to start... :P

 

Amazing work :)

 

Lee

Posted

Ahh, haven't got membership for the Swamp - but may have to consider delving in... looks like a good site.

  • 13 years later...
Posted
On 3/3/2009 at 6:21 AM, CAB said:

It's free.8)

I can't join this site because they ask stupid questions. I doubt their seriousness.

  • Dislike 3
Posted
20 hours ago, Husso said:

I can't join this site because they ask stupid questions. I doubt their seriousness.

 

Its to combat spam and its only for like your first 5 or so posts.

  • Thanks 1

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...