TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: One Shot on April 25, 2008, 09:58:19 AM

Title: Request for a Cubicle line lisp
Post by: One Shot on April 25, 2008, 09:58:19 AM
This is a request for 2 lisp routine. 

Lisp (1)   I am looking for a lisp that will create an area boundry line. 
Lisp (2) is to take the intersection of the each corner to complete a polyline. 

Please provide the layer into the rounties.  (A-Anno-Occupancy Area-Sq Ft)

Please the attachment for my idea requests.
Title: Re: Request for a Cubicle line lisp
Post by: CADaver on April 25, 2008, 10:05:30 AM
http://www.theswamp.org/index.php?topic=2621.msg33156#msg33156
Title: Re: Request for a Cubicle line lisp
Post by: One Shot on April 25, 2008, 10:35:02 AM
Did I do anything wrong by you reply?
Title: Re: Request for a Cubicle line lisp
Post by: ronjonp on April 25, 2008, 10:57:41 AM
Here's a free Friday fish :)

Code: [Select]
(defun c:ca (/ lname pt1 pt2 pt3 pt4)
  (if (and (setq pt1 (getpoint "\n Pick upper left inside corner: "))
   (setq pt3 (getcorner pt1
"\n Pick bottom right inside corner: "
     )
   )
      )
    (progn
      (setq lname "a-anno-occupancy area-sq ft"
    pt1   (polar pt1 (angtof "135.0") 1.414)
    pt3   (polar pt3 (angtof "315.0") 1.414)
    pt2   (list (car pt3) (cadr pt1))
    pt4   (list (car pt1) (cadr pt3))
      )
      (rjp-addrectang pt1 pt3 lname)
      (rjp-add2lines lname pt1 "90" "180")
      (rjp-add2lines lname pt2 "90" "0")
      (rjp-add2lines lname pt3 "270" "0")
      (rjp-add2lines lname pt4 "270" "180")
    )
  )
  (princ)
)

(defun rjp-add2lines (lyr spt ang ang2 /)
  (entmakex
    (list '(0 . "LINE")
  '(100 . "AcDbEntity")
  (cons 8 lyr)
  '(100 . "AcDbLine")
  (cons 10 spt)
  (cons 11 (polar spt (angtof ang) 1.0))
    )
  )
  (entmakex
    (list '(0 . "LINE")
  '(100 . "AcDbEntity")
  (cons 8 lyr)
  '(100 . "AcDbLine")
  (cons 10 spt)
  (cons 11 (polar spt (angtof ang2) 1.0))
    )
  )
)

(defun rjp-addrectang (pt1 pt2 lay /)
  (entmakex
    (list '(0 . "LWPOLYLINE")
  (cons 100 "AcDbEntity")
  (cons 8 lay)
  (cons 100 "AcDbPolyline")
  '(90 . 4)
  '(70 . 1)
  (cons 10 pt1)
  (cons 10 (list (car pt2) (cadr pt1)))
  (cons 10 pt2)
  (cons 10 (list (car pt1) (cadr pt2)))
    )
  )
)
Title: Re: Request for a Cubicle line lisp
Post by: One Shot on April 25, 2008, 11:00:42 AM
Here's a free Friday fish :)

Code: [Select]
(defun c:ca (/ lname pt1 pt2 pt3 pt4)
  (if (and (setq pt1 (getpoint "\n Pick upper left inside corner: "))
   (setq pt3 (getcorner pt1
"\n Pick bottom right inside corner: "
     )
   )
      )
    (progn
      (setq lname "a-anno-occupancy area-sq ft"
    pt1   (polar pt1 (angtof "135.0") 1.414)
    pt3   (polar pt3 (angtof "315.0") 1.414)
    pt2   (list (car pt3) (cadr pt1))
    pt4   (list (car pt1) (cadr pt3))
      )
      (rjp-addrectang pt1 pt3 lname)
      (rjp-add2lines lname pt1 "90" "180")
      (rjp-add2lines lname pt2 "90" "0")
      (rjp-add2lines lname pt3 "270" "0")
      (rjp-add2lines lname pt4 "270" "180")
    )
  )
  (princ)
)

(defun rjp-add2lines (lyr spt ang ang2 /)
  (entmakex
    (list '(0 . "LINE")
  '(100 . "AcDbEntity")
  (cons 8 lyr)
  '(100 . "AcDbLine")
  (cons 10 spt)
  (cons 11 (polar spt (angtof ang) 1.0))
    )
  )
  (entmakex
    (list '(0 . "LINE")
  '(100 . "AcDbEntity")
  (cons 8 lyr)
  '(100 . "AcDbLine")
  (cons 10 spt)
  (cons 11 (polar spt (angtof ang2) 1.0))
    )
  )
)

(defun rjp-addrectang (pt1 pt2 lay /)
  (entmakex
    (list '(0 . "LWPOLYLINE")
  (cons 100 "AcDbEntity")
  (cons 8 lay)
  (cons 100 "AcDbPolyline")
  '(90 . 4)
  '(70 . 1)
  (cons 10 pt1)
  (cons 10 (list (car pt2) (cadr pt1)))
  (cons 10 pt2)
  (cons 10 (list (car pt1) (cadr pt2)))
    )
  )
)

Thank you very much Ron.  I really appreciate it.
Title: Re: Request for a Cubicle line lisp
Post by: ronjonp on April 25, 2008, 11:04:31 AM
You're welcome. :-)
Title: Re: Request for a Cubicle line lisp
Post by: One Shot on April 25, 2008, 11:16:39 AM
Ron,

If you look at the Cubicle Lisp 2 dwg  and you see the arrows pointing to the intersection.  Is there a way to get the midpoint of these lines to automaticaly knows the intersection.

Please see the attachment.
Title: Re: Request for a Cubicle line lisp
Post by: ronjonp on April 25, 2008, 11:41:48 AM
It's not very hard to do. What need to be done with these points?
Title: Re: Request for a Cubicle line lisp
Post by: One Shot on April 25, 2008, 11:50:58 AM
Imagine if you draw an invisible line from each midpoint to create an intersection.  At these intersections you could start or finish the polyline.  If you look at Lisp 1.dwg in the previous attachment that will show you what it should look like.
Title: Re: Request for a Cubicle line lisp
Post by: ronjonp on April 25, 2008, 12:00:37 PM
The routine already does the lisp1 example?
Title: Re: Request for a Cubicle line lisp
Post by: One Shot on April 25, 2008, 01:37:58 PM
Ron,

I am sorry for that.  I was over thinking this lisp.

It works greats!

Brad
Title: Re: Request for a Cubicle line lisp
Post by: ronjonp on April 25, 2008, 01:49:35 PM
Ron,

I am sorry for that.  I was over thinking this lisp.

It works greats!

Brad
:kewl:
Title: Re: Request for a Cubicle line lisp
Post by: jbuzbee on April 25, 2008, 01:55:11 PM
Ron,

Are fish ever really free?  :kewl:
Title: Re: Request for a Cubicle line lisp
Post by: CADaver on April 25, 2008, 02:24:58 PM
Did I do anything wrong by you reply?
Oh not at all, and I didn't mean to indicate such.  It's just the basic role of theSwamp, and its many very capable denizens, are (IMMHO) to "teach" you how to do it yourself.  Often some kind soul, like Ron here, will give you a whole fish, cleaned, cooked, and served with lemon and parsley.  But (more often than not, I think) others here will walk you through the steps of doing it yourself and thereby equipping you to handle issues like this as they arise.

Feel free to ask, but don't be surprised when someone "baits" you with only snippets of code.  Understand as well, that the folks here also have real jobs with real deadlines and often real bosses and may not have time to prepare a fully cooked fish.

Man, is it lunch yet? I'm getting hungry.