Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I needf help with a lisp routine

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
714 Views, 10 Replies

I needf help with a lisp routine

Ok I know that this routine I'm posting is probably the worst way to do what
I want, but since I'm very intermediate at lisp this is the only way I could
think of.

I want to be able to cut a wall (2 lines in 2d representing a wall, not 3d),
regardless of its angle and have it cut it at the right size and put in the
end caps. Then I want it to make the endcaps the previous selection so that
I can change the layer to a wall layer all within a menu. I use this to cut
openings for doors and windows, put the added wall ends on the right layer,
then I have the menu commands take over and insert a door or window block w/
attributes, pause for insertion, pause for changing the attributes position
and angle, change the layer of the attribute, then put the door on the right
layer.

This process works for me up until the wall is at an angle other than 0, 90,
180, 360. If the wall is at a 45 then it only selects one piece. I tried to
do a window from one point to another point but it didn't seem to work, and
neither does doing a fence.

So if there is anyone that can help get this working or has a better way of
doing this I would GREATLY appreciate it. I can post the menu info if
necessary so you can see exactly what I'm doing.

Thanks,
David

(defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
os an1 an2 an3 dst dst2 dsz dis osm)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(command "undo" "mark")
;GET CORNER/MIDPOINT CHOICE
(initget "C M")
(if (not CHS)
(setq CHS "C"))
(setq temp (getkword (strcat "\nInsert Door At The Corner Or Midpoint Of
The Wall? - (C/M): < "chs" > " )))
(if temp
(setq chs temp))

;EXECUTE CORNER / MIDPOINT
(if (= chs "C")
(progn
(setvar "orthomode" 1)
(command "osnap" "int")
(setq pt1 (getpoint "\nSelect Inner Corner: "))
(command "osnap" "near")
(setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb Location:
"))
(command "osnap" "per")
(setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened: "))
(setq ost 3)
(princ "\nOffset Distance:<")
(princ ost)
(setq dis (getdist "> "))
(setq ost (if (= dis nil)ost dis))
(setq drsz 26)
(setq ang1 (angle pt1 pt2))
(setq ang2 (angle pt1 pt3))
(setq pt4 (polar pt1 ang1 ost))
(setq pt5 (polar pt4 ang1 drsz))
(setq dist (distance pt1 pt3))
(setq pt6 (polar pt4 ang2 dist))
(setq pt7 (polar pt6 ang1 drsz))
(setvar "osmode" osm)
(command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 "" "line" pt4
pt6 "")
(ssget "w" pt4 pt7))
(if (= chs "M")
(progn
(setvar "orthomode" 1)
(command "osnap" "int,midp")
(setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
(command "osnap" "per")
(setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
(command "osnap" "near")
(setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb Location: "))
(setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb Location:
"))
(setq dsz 26)
(setq os (/ dsz 2))
(setq an1 (angle p1 p3))
(setq p4 (polar p1 an1 os))
(setq an2 (angle p1 hg))
(setq p5 (polar p1 an2 os))
(setq dst (distance p1 p2))
(setq an3 (angle p1 p2))
(setq p6 (polar p5 an3 dst))
(setq p7 (polar p6 an1 dsz))
(setq dst2 (/ dst 2))
(setq p8 (polar p5 an3 dst2))
(setq p9 (polar p4 an3 dst2))
(setvar "osmode" osm)
(command "break" p4 p5 "break" p7 p6 "line" p4 p7 "" "line" p5 p6 "")
(ssget "f" (list p8 p9))
)
)
)
) ;end AC20.lsp
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: Anonymous

David,
Pretty good, for someone "very intermediate at lisp".
A few suggestions if I might:
1. Use entlast after drawing each jamb. This avoids the potential of
selecting undesireable objects.
2. Make your code modular. The code that breaks the lines and draws the
jambs is nearly identical. Make this a separate procedure called by the
main routine. Make the door size (dsz) an argument to the ac20 function
(removing the c:). Then you could call this same function from your menu to
draw multiple door sizes: (ac20 26) for a 26 inch door, or (ac20 36) for a
36 inch door.
3. Use setvar to control the running osnaps instead of commmand.
4. Keep on Lispin'

Mike Weaver



"David Munoz" wrote in message
news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> Ok I know that this routine I'm posting is probably the worst way to do
what
> I want, but since I'm very intermediate at lisp this is the only way I
could
> think of.
>
> I want to be able to cut a wall (2 lines in 2d representing a wall, not
3d),
> regardless of its angle and have it cut it at the right size and put in
the
> end caps. Then I want it to make the endcaps the previous selection so
that
> I can change the layer to a wall layer all within a menu. I use this to
cut
> openings for doors and windows, put the added wall ends on the right
layer,
> then I have the menu commands take over and insert a door or window block
w/
> attributes, pause for insertion, pause for changing the attributes
position
> and angle, change the layer of the attribute, then put the door on the
right
> layer.
>
> This process works for me up until the wall is at an angle other than 0,
90,
> 180, 360. If the wall is at a 45 then it only selects one piece. I tried
to
> do a window from one point to another point but it didn't seem to work,
and
> neither does doing a fence.
>
> So if there is anyone that can help get this working or has a better way
of
> doing this I would GREATLY appreciate it. I can post the menu info if
> necessary so you can see exactly what I'm doing.
>
> Thanks,
> David
>
> (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
> p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> os an1 an2 an3 dst dst2 dsz dis osm)
> (setq osm (getvar "osmode"))
> (setvar "osmode" 0)
> (command "undo" "mark")
> ;GET CORNER/MIDPOINT CHOICE
> (initget "C M")
> (if (not CHS)
> (setq CHS "C"))
> (setq temp (getkword (strcat "\nInsert Door At The Corner Or Midpoint Of
> The Wall? - (C/M): < "chs" > " )))
> (if temp
> (setq chs temp))
>
> ;EXECUTE CORNER / MIDPOINT
> (if (= chs "C")
> (progn
> (setvar "orthomode" 1)
> (command "osnap" "int")
> (setq pt1 (getpoint "\nSelect Inner Corner: "))
> (command "osnap" "near")
> (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
Location:
> "))
> (command "osnap" "per")
> (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened: "))
> (setq ost 3)
> (princ "\nOffset Distance:<")
> (princ ost)
> (setq dis (getdist "> "))
> (setq ost (if (= dis nil)ost dis))
> (setq drsz 26)
> (setq ang1 (angle pt1 pt2))
> (setq ang2 (angle pt1 pt3))
> (setq pt4 (polar pt1 ang1 ost))
> (setq pt5 (polar pt4 ang1 drsz))
> (setq dist (distance pt1 pt3))
> (setq pt6 (polar pt4 ang2 dist))
> (setq pt7 (polar pt6 ang1 drsz))
> (setvar "osmode" osm)
> (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 "" "line"
pt4
> pt6 "")
> (ssget "w" pt4 pt7))
> (if (= chs "M")
> (progn
> (setvar "orthomode" 1)
> (command "osnap" "int,midp")
> (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> (command "osnap" "per")
> (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
> (command "osnap" "near")
> (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb Location:
"))
> (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb Location:
> "))
> (setq dsz 26)
> (setq os (/ dsz 2))
> (setq an1 (angle p1 p3))
> (setq p4 (polar p1 an1 os))
> (setq an2 (angle p1 hg))
> (setq p5 (polar p1 an2 os))
> (setq dst (distance p1 p2))
> (setq an3 (angle p1 p2))
> (setq p6 (polar p5 an3 dst))
> (setq p7 (polar p6 an1 dsz))
> (setq dst2 (/ dst 2))
> (setq p8 (polar p5 an3 dst2))
> (setq p9 (polar p4 an3 dst2))
> (setvar "osmode" osm)
> (command "break" p4 p5 "break" p7 p6 "line" p4 p7 "" "line" p5 p6
"")
> (ssget "f" (list p8 p9))
> )
> )
> )
> ) ;end AC20.lsp
>
>
>
Message 3 of 11
Anonymous
in reply to: Anonymous

David,

This doesn't exactly answer your question, but is a similar progam that I did some time back. Thought you might be interested, and can maybe adapt it to your needs.

The option, offset from start point allows you to pick the corner or endpoint and start the actual opening a selected distance from that point (works well for my use).

Jesse


(defun C:DoorOpening (/ OffSet DoorOpng
StartPoint OppositeWall Direction
BreakIt
)
(setq OffSet (getdist "\n Amount of OFFSET from Start POINT <0>: "))
(if (not OffSet)
(setq OffSet 0)
)
(setq DoorOpng (getdist "\n Door Opening : "))
(setq StartPoint
(osnap
(getpoint
"\nStart (HINGE Point or HINGE Side) Of OPENING: "
)
"nea"
)
)
(setq Direction
(osnap
(getpoint "\n Direction of OPENING From START Point: ")
"nea"
)
)
(setvar "lastpoint" Direction)
(setq
OppositeWall
(osnap
(getpoint "\n Touch OPPOSITE Wall: "
)
"perp"
)
)
(setq StartPoint
(polar StartPoint (angle StartPoint Direction) OffSet)
)
(setq OppositePoint
(polar StartPoint
(angle Direction OppositeWall)
(distance Direction OppositeWall)
)
)
(command "line" StartPoint OppositePoint "")
(setq BreakIT (ssadd (entlast)))
(command "copy"
(entlast)
""
StartPoint
(polar StartPoint (angle StartPoint Direction) DoorOpng)
)
(command "trim"
Breakit
(entlast)
""
(polar StartPoint
(angle StartPoint Direction)
(/ DoorOpng 2)
)
(polar OppositePoint
(angle StartPoint Direction)
(/ DoorOpng 2)
)
""
)
(command "redraw")
(princ)
)
Message 4 of 11
Anonymous
in reply to: Anonymous

Thanks for the compliment. Thanks for taking the time to offer some help. I
am a little confused with using entlast though. How do I create a selection
set of both the line I have drawn? If I do something like this:

(command
"break" pt5 pt4 "break" pt7 pt6)
(command
"line" pt5 pt7 "")
(setq en1 (entlast))
(command
"line" pt4 pt6 "")
(setq en2 (entlast))

How can I get en1 and en2 to be the previous selection set so that I may
change "previous" to a specific layer once the menu portion takes over?

Now if I make the door size an argument to the ac20 function wouldn't I have
to have input from the user for a size? I wrote a lisp for every size that I
need just so I could eliminate the user input, other than the picking of
points.

Here is a small portion of the menu so you can see what I was trying to do.

**Plfldra4_1
[1st Floor AutoCut Door In A 2x4]
[d20l90s4,2068 Left
Std]^C^Cac20;\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;last;;la;a1-door;;(menucmd
"gresidential.id_plfldra4_1=|")

Oh wait....never mind I just noticed where I would do that. Well at least
you can see what I'm trying to do with the "change previous" thing.

Once again thank you very much for the help. I really appreciate it.

Take care,
David

"Mike Weaver" wrote in message
news:48728F020942872ACE36496270CF42D6@in.WebX.maYIadrTaRb...
> David,
> Pretty good, for someone "very intermediate at lisp".
> A few suggestions if I might:
> 1. Use entlast after drawing each jamb. This avoids the potential of
> selecting undesireable objects.
> 2. Make your code modular. The code that breaks the lines and draws the
> jambs is nearly identical. Make this a separate procedure called by the
> main routine. Make the door size (dsz) an argument to the ac20 function
> (removing the c:). Then you could call this same function from your menu
to
> draw multiple door sizes: (ac20 26) for a 26 inch door, or (ac20 36) for
a
> 36 inch door.
> 3. Use setvar to control the running osnaps instead of commmand.
> 4. Keep on Lispin'
>
> Mike Weaver
>
>
>
> "David Munoz" wrote in message
> news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> > Ok I know that this routine I'm posting is probably the worst way to do
> what
> > I want, but since I'm very intermediate at lisp this is the only way I
> could
> > think of.
> >
> > I want to be able to cut a wall (2 lines in 2d representing a wall, not
> 3d),
> > regardless of its angle and have it cut it at the right size and put in
> the
> > end caps. Then I want it to make the endcaps the previous selection so
> that
> > I can change the layer to a wall layer all within a menu. I use this to
> cut
> > openings for doors and windows, put the added wall ends on the right
> layer,
> > then I have the menu commands take over and insert a door or window
block
> w/
> > attributes, pause for insertion, pause for changing the attributes
> position
> > and angle, change the layer of the attribute, then put the door on the
> right
> > layer.
> >
> > This process works for me up until the wall is at an angle other than 0,
> 90,
> > 180, 360. If the wall is at a 45 then it only selects one piece. I tried
> to
> > do a window from one point to another point but it didn't seem to work,
> and
> > neither does doing a fence.
> >
> > So if there is anyone that can help get this working or has a better way
> of
> > doing this I would GREATLY appreciate it. I can post the menu info if
> > necessary so you can see exactly what I'm doing.
> >
> > Thanks,
> > David
> >
> > (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
> > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > os an1 an2 an3 dst dst2 dsz dis osm)
> > (setq osm (getvar "osmode"))
> > (setvar "osmode" 0)
> > (command "undo" "mark")
> > ;GET CORNER/MIDPOINT CHOICE
> > (initget "C M")
> > (if (not CHS)
> > (setq CHS "C"))
> > (setq temp (getkword (strcat "\nInsert Door At The Corner Or Midpoint
Of
> > The Wall? - (C/M): < "chs" > " )))
> > (if temp
> > (setq chs temp))
> >
> > ;EXECUTE CORNER / MIDPOINT
> > (if (= chs "C")
> > (progn
> > (setvar "orthomode" 1)
> > (command "osnap" "int")
> > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > (command "osnap" "near")
> > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
> Location:
> > "))
> > (command "osnap" "per")
> > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened: "))
> > (setq ost 3)
> > (princ "\nOffset Distance:<")
> > (princ ost)
> > (setq dis (getdist "> "))
> > (setq ost (if (= dis nil)ost dis))
> > (setq drsz 26)
> > (setq ang1 (angle pt1 pt2))
> > (setq ang2 (angle pt1 pt3))
> > (setq pt4 (polar pt1 ang1 ost))
> > (setq pt5 (polar pt4 ang1 drsz))
> > (setq dist (distance pt1 pt3))
> > (setq pt6 (polar pt4 ang2 dist))
> > (setq pt7 (polar pt6 ang1 drsz))
> > (setvar "osmode" osm)
> > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 "" "line"
> pt4
> > pt6 "")
> > (ssget "w" pt4 pt7))
> > (if (= chs "M")
> > (progn
> > (setvar "orthomode" 1)
> > (command "osnap" "int,midp")
> > (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> > (command "osnap" "per")
> > (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
> > (command "osnap" "near")
> > (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb Location:
> "))
> > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
Location:
> > "))
> > (setq dsz 26)
> > (setq os (/ dsz 2))
> > (setq an1 (angle p1 p3))
> > (setq p4 (polar p1 an1 os))
> > (setq an2 (angle p1 hg))
> > (setq p5 (polar p1 an2 os))
> > (setq dst (distance p1 p2))
> > (setq an3 (angle p1 p2))
> > (setq p6 (polar p5 an3 dst))
> > (setq p7 (polar p6 an1 dsz))
> > (setq dst2 (/ dst 2))
> > (setq p8 (polar p5 an3 dst2))
> > (setq p9 (polar p4 an3 dst2))
> > (setvar "osmode" osm)
> > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 "" "line" p5 p6
> "")
> > (ssget "f" (list p8 p9))
> > )
> > )
> > )
> > ) ;end AC20.lsp
> >
> >
> >
>
>
Message 5 of 11
Anonymous
in reply to: Anonymous

Thanks for the info. I may be able to use some of
that.

 

Take care,

David


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
David,

This doesn't exactly answer your question, but is a similar progam that I
did some time back. Thought you might be interested, and can maybe adapt it to
your needs.

The option, offset from start point allows you to pick the corner or
endpoint and start the actual opening a selected distance from that point
(works well for my use).

Jesse


(defun C:DoorOpening (/ OffSet DoorOpng
StartPoint OppositeWall
Direction
BreakIt
)
  (setq OffSet (getdist "\n Amount
of OFFSET from Start POINT <0>: "))
  (if (not OffSet)

    (setq OffSet 0)
  )

  (setq DoorOpng (getdist "\n Door Opening : "))

  (setq StartPoint
(osnap
(getpoint
"\nStart (HINGE
Point or HINGE Side) Of OPENING: "
)
"nea"
)
  )

  (setq Direction
(osnap
(getpoint "\n Direction of
OPENING From START Point: ")
"nea"
)
  )

  (setvar "lastpoint" Direction)
  (setq

    OppositeWall

     (osnap

       (getpoint "\n Touch OPPOSITE
Wall: "
       )

       "perp"

     )
  )
  (setq
StartPoint
(polar StartPoint (angle StartPoint Direction) OffSet)

  )
  (setq OppositePoint
(polar StartPoint

(angle Direction OppositeWall)
(distance Direction OppositeWall)
)

  )
  (command "line" StartPoint OppositePoint "")

  (setq BreakIT (ssadd (entlast)))
  (command
"copy"
(entlast)
""
StartPoint
(polar StartPoint (angle
StartPoint Direction) DoorOpng)
  )
  (command
"trim"
Breakit
(entlast)
""
(polar StartPoint
(angle
StartPoint Direction)
(/ DoorOpng 2)
)
(polar OppositePoint

(angle StartPoint Direction)
(/ DoorOpng 2)
)
""

  )
  (command "redraw")
  (princ)

)

Message 6 of 11
Anonymous
in reply to: Anonymous

David,
I wouldn't use a seelction set. Make your AC20 routine return the enames
for the jambs as a list thus:> (command

"break" pt5 pt4 "break" pt7 pt6)
(command
"line" pt5 pt7 "")
(setq rtlist (list (entlast)))
(command
"line" pt4 pt6 "")
(setq rtlist (append rtlist (entlast)))

then at the end of your AC20 routine, just before the closing paren put
rtlist. This will return a list with the entity names of both jambs to the
calling menu item. Which could be modified as follows to use the return
value:


**Plfldra4_1
[1st Floor AutoCut Door In A 2x4]
[d20l90s4,2068 Left Std]^C^C(setq jambs (ac20
26));\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;(car jambs);(cadr
jambs);;la;a1-door;;(menucmd
"gresidential.id_plfldra4_1=|")



Keep at it!

Mike

"David Munoz" wrote in message
news:06310A24135AC6674C1ADD32702D3FBE@in.WebX.maYIadrTaRb...
> Thanks for the compliment. Thanks for taking the time to offer some help.
I
> am a little confused with using entlast though. How do I create a
selection
> set of both the line I have drawn? If I do something like this:
>
> (command
> "break" pt5 pt4 "break" pt7 pt6)
> (command
> "line" pt5 pt7 "")
> (setq en1 (entlast))
> (command
> "line" pt4 pt6 "")
> (setq en2 (entlast))
>
> How can I get en1 and en2 to be the previous selection set so that I may
> change "previous" to a specific layer once the menu portion takes over?
>
> Now if I make the door size an argument to the ac20 function wouldn't I
have
> to have input from the user for a size? I wrote a lisp for every size that
I
> need just so I could eliminate the user input, other than the picking of
> points.
>
> Here is a small portion of the menu so you can see what I was trying to
do.
>
> **Plfldra4_1
> [1st Floor AutoCut Door In A 2x4]
> [d20l90s4,2068 Left
>
Std]^C^Cac20;\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;last;;la;a1-door;;(menucmd
> "gresidential.id_plfldra4_1=|")
>
> Oh wait....never mind I just noticed where I would do that. Well at least
> you can see what I'm trying to do with the "change previous" thing.
>
> Once again thank you very much for the help. I really appreciate it.
>
> Take care,
> David
>
> "Mike Weaver" wrote in message
> news:48728F020942872ACE36496270CF42D6@in.WebX.maYIadrTaRb...
> > David,
> > Pretty good, for someone "very intermediate at lisp".
> > A few suggestions if I might:
> > 1. Use entlast after drawing each jamb. This avoids the potential of
> > selecting undesireable objects.
> > 2. Make your code modular. The code that breaks the lines and draws
the
> > jambs is nearly identical. Make this a separate procedure called by the
> > main routine. Make the door size (dsz) an argument to the ac20 function
> > (removing the c:). Then you could call this same function from your
menu
> to
> > draw multiple door sizes: (ac20 26) for a 26 inch door, or (ac20 36)
for
> a
> > 36 inch door.
> > 3. Use setvar to control the running osnaps instead of commmand.
> > 4. Keep on Lispin'
> >
> > Mike Weaver
> >
> >
> >
> > "David Munoz" wrote in message
> > news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> > > Ok I know that this routine I'm posting is probably the worst way to
do
> > what
> > > I want, but since I'm very intermediate at lisp this is the only way I
> > could
> > > think of.
> > >
> > > I want to be able to cut a wall (2 lines in 2d representing a wall,
not
> > 3d),
> > > regardless of its angle and have it cut it at the right size and put
in
> > the
> > > end caps. Then I want it to make the endcaps the previous selection so
> > that
> > > I can change the layer to a wall layer all within a menu. I use this
to
> > cut
> > > openings for doors and windows, put the added wall ends on the right
> > layer,
> > > then I have the menu commands take over and insert a door or window
> block
> > w/
> > > attributes, pause for insertion, pause for changing the attributes
> > position
> > > and angle, change the layer of the attribute, then put the door on the
> > right
> > > layer.
> > >
> > > This process works for me up until the wall is at an angle other than
0,
> > 90,
> > > 180, 360. If the wall is at a 45 then it only selects one piece. I
tried
> > to
> > > do a window from one point to another point but it didn't seem to
work,
> > and
> > > neither does doing a fence.
> > >
> > > So if there is anyone that can help get this working or has a better
way
> > of
> > > doing this I would GREATLY appreciate it. I can post the menu info if
> > > necessary so you can see exactly what I'm doing.
> > >
> > > Thanks,
> > > David
> > >
> > > (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
> > > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > > os an1 an2 an3 dst dst2 dsz dis osm)
> > > (setq osm (getvar "osmode"))
> > > (setvar "osmode" 0)
> > > (command "undo" "mark")
> > > ;GET CORNER/MIDPOINT CHOICE
> > > (initget "C M")
> > > (if (not CHS)
> > > (setq CHS "C"))
> > > (setq temp (getkword (strcat "\nInsert Door At The Corner Or
Midpoint
> Of
> > > The Wall? - (C/M): < "chs" > " )))
> > > (if temp
> > > (setq chs temp))
> > >
> > > ;EXECUTE CORNER / MIDPOINT
> > > (if (= chs "C")
> > > (progn
> > > (setvar "orthomode" 1)
> > > (command "osnap" "int")
> > > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > > (command "osnap" "near")
> > > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
> > Location:
> > > "))
> > > (command "osnap" "per")
> > > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened: "))
> > > (setq ost 3)
> > > (princ "\nOffset Distance:<")
> > > (princ ost)
> > > (setq dis (getdist "> "))
> > > (setq ost (if (= dis nil)ost dis))
> > > (setq drsz 26)
> > > (setq ang1 (angle pt1 pt2))
> > > (setq ang2 (angle pt1 pt3))
> > > (setq pt4 (polar pt1 ang1 ost))
> > > (setq pt5 (polar pt4 ang1 drsz))
> > > (setq dist (distance pt1 pt3))
> > > (setq pt6 (polar pt4 ang2 dist))
> > > (setq pt7 (polar pt6 ang1 drsz))
> > > (setvar "osmode" osm)
> > > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 ""
"line"
> > pt4
> > > pt6 "")
> > > (ssget "w" pt4 pt7))
> > > (if (= chs "M")
> > > (progn
> > > (setvar "orthomode" 1)
> > > (command "osnap" "int,midp")
> > > (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> > > (command "osnap" "per")
> > > (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
> > > (command "osnap" "near")
> > > (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb
Location:
> > "))
> > > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
> Location:
> > > "))
> > > (setq dsz 26)
> > > (setq os (/ dsz 2))
> > > (setq an1 (angle p1 p3))
> > > (setq p4 (polar p1 an1 os))
> > > (setq an2 (angle p1 hg))
> > > (setq p5 (polar p1 an2 os))
> > > (setq dst (distance p1 p2))
> > > (setq an3 (angle p1 p2))
> > > (setq p6 (polar p5 an3 dst))
> > > (setq p7 (polar p6 an1 dsz))
> > > (setq dst2 (/ dst 2))
> > > (setq p8 (polar p5 an3 dst2))
> > > (setq p9 (polar p4 an3 dst2))
> > > (setvar "osmode" osm)
> > > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 "" "line" p5
p6
> > "")
> > > (ssget "f" (list p8 p9))
> > > )
> > > )
> > > )
> > > ) ;end AC20.lsp
> > >
> > >
> > >
> >
> >
>
>
Message 7 of 11
Anonymous
in reply to: Anonymous

Mike,
I'm confused again.... I modified the lisp routine to match what you did,
then I added rtlist right before the last closing paren and I got this error
; error: bad argument type: listp
I took out the rtlist before the last closing paren and it gave me:
; error: bad argument type: listp
I took out the (setq rtlist (append rtlist (entlast))) part and get a nil at
the end of the routine.

I think I understand what you're talking about with the(car jambs) and (cadr
jambs) but I'm not completely sure.
By doing (setq jambs(ac20 26)) is this supposed to execute the ac20 lisp and
if so what is the 26 for? Now by putting rtlist at
the end of the ac20 lisp does that leave the rtlist value available for
setting the jambs variable to? That would be why you would step through the
jambs variable with car and cadr right? Car would extract the first jamb and
cadr would extract the second jamb right? I can't get (setq jambs(ac20 26))
or (setq jambs(ac20)) to work. it just gives me ; error: no function
definition: AC20. I did (setq jambs(c:ac20)) which executed the ac20 lisp
but I still got the above list errors and jambs is set to nil.

Once again thanks for taking the time to help me out. I appreciate it.

Dave


"Mike Weaver" wrote in message
news:B449CFD09218E49CD33036845A7377A1@in.WebX.maYIadrTaRb...
> David,
> I wouldn't use a seelction set. Make your AC20 routine return the enames
> for the jambs as a list thus:> (command
>
> "break" pt5 pt4 "break" pt7 pt6)
> (command
> "line" pt5 pt7 "")
> (setq rtlist (list (entlast)))
> (command
> "line" pt4 pt6 "")
> (setq rtlist (append rtlist (entlast)))
>
> then at the end of your AC20 routine, just before the closing paren put
> rtlist. This will return a list with the entity names of both jambs to
the
> calling menu item. Which could be modified as follows to use the return
> value:
>
>
> **Plfldra4_1
> [1st Floor AutoCut Door In A 2x4]
> [d20l90s4,2068 Left Std]^C^C(setq jambs (ac20
> 26));\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;(car jambs);(cadr
> jambs);;la;a1-door;;(menucmd
> "gresidential.id_plfldra4_1=|")
>
>
>
> Keep at it!
>
> Mike
>
> "David Munoz" wrote in message
> news:06310A24135AC6674C1ADD32702D3FBE@in.WebX.maYIadrTaRb...
> > Thanks for the compliment. Thanks for taking the time to offer some
help.
> I
> > am a little confused with using entlast though. How do I create a
> selection
> > set of both the line I have drawn? If I do something like this:
> >
> > (command
> > "break" pt5 pt4 "break" pt7 pt6)
> > (command
> > "line" pt5 pt7 "")
> > (setq en1 (entlast))
> > (command
> > "line" pt4 pt6 "")
> > (setq en2 (entlast))
> >
> > How can I get en1 and en2 to be the previous selection set so that I may
> > change "previous" to a specific layer once the menu portion takes over?
> >
> > Now if I make the door size an argument to the ac20 function wouldn't I
> have
> > to have input from the user for a size? I wrote a lisp for every size
that
> I
> > need just so I could eliminate the user input, other than the picking of
> > points.
> >
> > Here is a small portion of the menu so you can see what I was trying to
> do.
> >
> > **Plfldra4_1
> > [1st Floor AutoCut Door In A 2x4]
> > [d20l90s4,2068 Left
> >
>
Std]^C^Cac20;\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> >
ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;last;;la;a1-door;;(menucmd
> > "gresidential.id_plfldra4_1=|")
> >
> > Oh wait....never mind I just noticed where I would do that. Well at
least
> > you can see what I'm trying to do with the "change previous" thing.
> >
> > Once again thank you very much for the help. I really appreciate it.
> >
> > Take care,
> > David
> >
> > "Mike Weaver" wrote in message
> > news:48728F020942872ACE36496270CF42D6@in.WebX.maYIadrTaRb...
> > > David,
> > > Pretty good, for someone "very intermediate at lisp".
> > > A few suggestions if I might:
> > > 1. Use entlast after drawing each jamb. This avoids the potential of
> > > selecting undesireable objects.
> > > 2. Make your code modular. The code that breaks the lines and draws
> the
> > > jambs is nearly identical. Make this a separate procedure called by
the
> > > main routine. Make the door size (dsz) an argument to the ac20
function
> > > (removing the c:). Then you could call this same function from your
> menu
> > to
> > > draw multiple door sizes: (ac20 26) for a 26 inch door, or (ac20 36)
> for
> > a
> > > 36 inch door.
> > > 3. Use setvar to control the running osnaps instead of commmand.
> > > 4. Keep on Lispin'
> > >
> > > Mike Weaver
> > >
> > >
> > >
> > > "David Munoz" wrote in message
> > > news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> > > > Ok I know that this routine I'm posting is probably the worst way to
> do
> > > what
> > > > I want, but since I'm very intermediate at lisp this is the only way
I
> > > could
> > > > think of.
> > > >
> > > > I want to be able to cut a wall (2 lines in 2d representing a wall,
> not
> > > 3d),
> > > > regardless of its angle and have it cut it at the right size and put
> in
> > > the
> > > > end caps. Then I want it to make the endcaps the previous selection
so
> > > that
> > > > I can change the layer to a wall layer all within a menu. I use this
> to
> > > cut
> > > > openings for doors and windows, put the added wall ends on the right
> > > layer,
> > > > then I have the menu commands take over and insert a door or window
> > block
> > > w/
> > > > attributes, pause for insertion, pause for changing the attributes
> > > position
> > > > and angle, change the layer of the attribute, then put the door on
the
> > > right
> > > > layer.
> > > >
> > > > This process works for me up until the wall is at an angle other
than
> 0,
> > > 90,
> > > > 180, 360. If the wall is at a 45 then it only selects one piece. I
> tried
> > > to
> > > > do a window from one point to another point but it didn't seem to
> work,
> > > and
> > > > neither does doing a fence.
> > > >
> > > > So if there is anyone that can help get this working or has a better
> way
> > > of
> > > > doing this I would GREATLY appreciate it. I can post the menu info
if
> > > > necessary so you can see exactly what I'm doing.
> > > >
> > > > Thanks,
> > > > David
> > > >
> > > > (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
> > > > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > > > os an1 an2 an3 dst dst2 dsz dis osm)
> > > > (setq osm (getvar "osmode"))
> > > > (setvar "osmode" 0)
> > > > (command "undo" "mark")
> > > > ;GET CORNER/MIDPOINT CHOICE
> > > > (initget "C M")
> > > > (if (not CHS)
> > > > (setq CHS "C"))
> > > > (setq temp (getkword (strcat "\nInsert Door At The Corner Or
> Midpoint
> > Of
> > > > The Wall? - (C/M): < "chs" > " )))
> > > > (if temp
> > > > (setq chs temp))
> > > >
> > > > ;EXECUTE CORNER / MIDPOINT
> > > > (if (= chs "C")
> > > > (progn
> > > > (setvar "orthomode" 1)
> > > > (command "osnap" "int")
> > > > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > > > (command "osnap" "near")
> > > > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
> > > Location:
> > > > "))
> > > > (command "osnap" "per")
> > > > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened:
"))
> > > > (setq ost 3)
> > > > (princ "\nOffset Distance:<")
> > > > (princ ost)
> > > > (setq dis (getdist "> "))
> > > > (setq ost (if (= dis nil)ost dis))
> > > > (setq drsz 26)
> > > > (setq ang1 (angle pt1 pt2))
> > > > (setq ang2 (angle pt1 pt3))
> > > > (setq pt4 (polar pt1 ang1 ost))
> > > > (setq pt5 (polar pt4 ang1 drsz))
> > > > (setq dist (distance pt1 pt3))
> > > > (setq pt6 (polar pt4 ang2 dist))
> > > > (setq pt7 (polar pt6 ang1 drsz))
> > > > (setvar "osmode" osm)
> > > > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 ""
> "line"
> > > pt4
> > > > pt6 "")
> > > > (ssget "w" pt4 pt7))
> > > > (if (= chs "M")
> > > > (progn
> > > > (setvar "orthomode" 1)
> > > > (command "osnap" "int,midp")
> > > > (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> > > > (command "osnap" "per")
> > > > (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
> > > > (command "osnap" "near")
> > > > (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb
> Location:
> > > "))
> > > > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
> > Location:
> > > > "))
> > > > (setq dsz 26)
> > > > (setq os (/ dsz 2))
> > > > (setq an1 (angle p1 p3))
> > > > (setq p4 (polar p1 an1 os))
> > > > (setq an2 (angle p1 hg))
> > > > (setq p5 (polar p1 an2 os))
> > > > (setq dst (distance p1 p2))
> > > > (setq an3 (angle p1 p2))
> > > > (setq p6 (polar p5 an3 dst))
> > > > (setq p7 (polar p6 an1 dsz))
> > > > (setq dst2 (/ dst 2))
> > > > (setq p8 (polar p5 an3 dst2))
> > > > (setq p9 (polar p4 an3 dst2))
> > > > (setvar "osmode" osm)
> > > > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 "" "line" p5
> p6
> > > "")
> > > > (ssget "f" (list p8 p9))
> > > > )
> > > > )
> > > > )
> > > > ) ;end AC20.lsp
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Message 8 of 11
Anonymous
in reply to: Anonymous

David,

See the attached.
The error messages you're getting are telling you a couple of things:
First the error is due to a bad argument type
Second, the argument type expected was a list
Third, the value supplied for the argument - in this case, an entity name

The append function requires lists for the arguments. So:
(setq rtlist (append (list (entlast)) rtlist))
should solve the problem. The attached file does this without using
append - simply combines the two return values into a list at the end of the
routine.

You'll see in the attached file that I have modified ac20 to require a
single argument - the value for the function drsz - in this case 26. Also,
at the end of the procedure, I've added (list en1 en2) so that these entity
names will be returned and can be accessed using car and cadr - just as you
recognized.
You go tthe no function definition error because your ac20 function has the
leading C:. The only reason for the C: is to make the function available
without parens. If we are going to be using drsz as an argument we have to
enclose it in parens and the C: then does nothing for us.

Supplying the door size (drsz) to the function as an argument allows you to
use the same code for all door sizes - no more changing the routines for
each door size when you have a change.

Mike Weaver


"David Munoz" wrote in message
news:E27F6B51B2A46239421002C9FFAFF217@in.WebX.maYIadrTaRb...
> Mike,
> I'm confused again.... I modified the lisp routine to match what you did,
> then I added rtlist right before the last closing paren and I got this
error
> ; error: bad argument type: listp
> I took out the rtlist before the last closing paren and it gave me:
> ; error: bad argument type: listp
> I took out the (setq rtlist (append rtlist (entlast))) part and get a nil
at
> the end of the routine.
>
> I think I understand what you're talking about with the(car jambs) and
(cadr
> jambs) but I'm not completely sure.
> By doing (setq jambs(ac20 26)) is this supposed to execute the ac20 lisp
and
> if so what is the 26 for? Now by putting rtlist at
> the end of the ac20 lisp does that leave the rtlist value available for
> setting the jambs variable to? That would be why you would step through
the
> jambs variable with car and cadr right? Car would extract the first jamb
and
> cadr would extract the second jamb right? I can't get (setq jambs(ac20
26))
> or (setq jambs(ac20)) to work. it just gives me ; error: no function
> definition: AC20. I did (setq jambs(c:ac20)) which executed the ac20 lisp
> but I still got the above list errors and jambs is set to nil.
>
> Once again thanks for taking the time to help me out. I appreciate it.
>
> Dave
>
>
> "Mike Weaver" wrote in message
> news:B449CFD09218E49CD33036845A7377A1@in.WebX.maYIadrTaRb...
> > David,
> > I wouldn't use a seelction set. Make your AC20 routine return the
enames
> > for the jambs as a list thus:> (command
> >
> > "break" pt5 pt4 "break" pt7 pt6)
> > (command
> > "line" pt5 pt7 "")
> > (setq rtlist (list (entlast)))
> > (command
> > "line" pt4 pt6 "")
> > (setq rtlist (append rtlist (entlast)))
> >
> > then at the end of your AC20 routine, just before the closing paren put
> > rtlist. This will return a list with the entity names of both jambs to
> the
> > calling menu item. Which could be modified as follows to use the return
> > value:
> >
> >
> > **Plfldra4_1
> > [1st Floor AutoCut Door In A 2x4]
> > [d20l90s4,2068 Left Std]^C^C(setq jambs (ac20
> > 26));\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;(car jambs);(cadr
> > jambs);;la;a1-door;;(menucmd
> > "gresidential.id_plfldra4_1=|")
> >
> >
> >
> > Keep at it!
> >
> > Mike
> >
> > "David Munoz" wrote in message
> > news:06310A24135AC6674C1ADD32702D3FBE@in.WebX.maYIadrTaRb...
> > > Thanks for the compliment. Thanks for taking the time to offer some
> help.
> > I
> > > am a little confused with using entlast though. How do I create a
> > selection
> > > set of both the line I have drawn? If I do something like this:
> > >
> > > (command
> > > "break" pt5 pt4 "break" pt7 pt6)
> > > (command
> > > "line" pt5 pt7 "")
> > > (setq en1 (entlast))
> > > (command
> > > "line" pt4 pt6 "")
> > > (setq en2 (entlast))
> > >
> > > How can I get en1 and en2 to be the previous selection set so that I
may
> > > change "previous" to a specific layer once the menu portion takes
over?
> > >
> > > Now if I make the door size an argument to the ac20 function wouldn't
I
> > have
> > > to have input from the user for a size? I wrote a lisp for every size
> that
> > I
> > > need just so I could eliminate the user input, other than the picking
of
> > > points.
> > >
> > > Here is a small portion of the menu so you can see what I was trying
to
> > do.
> > >
> > > **Plfldra4_1
> > > [1st Floor AutoCut Door In A 2x4]
> > > [d20l90s4,2068 Left
> > >
> >
>
Std]^C^Cac20;\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > >
> ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;last;;la;a1-door;;(menucmd
> > > "gresidential.id_plfldra4_1=|")
> > >
> > > Oh wait....never mind I just noticed where I would do that. Well at
> least
> > > you can see what I'm trying to do with the "change previous" thing.
> > >
> > > Once again thank you very much for the help. I really appreciate it.
> > >
> > > Take care,
> > > David
> > >
> > > "Mike Weaver" wrote in message
> > > news:48728F020942872ACE36496270CF42D6@in.WebX.maYIadrTaRb...
> > > > David,
> > > > Pretty good, for someone "very intermediate at lisp".
> > > > A few suggestions if I might:
> > > > 1. Use entlast after drawing each jamb. This avoids the potential
of
> > > > selecting undesireable objects.
> > > > 2. Make your code modular. The code that breaks the lines and
draws
> > the
> > > > jambs is nearly identical. Make this a separate procedure called by
> the
> > > > main routine. Make the door size (dsz) an argument to the ac20
> function
> > > > (removing the c:). Then you could call this same function from your
> > menu
> > > to
> > > > draw multiple door sizes: (ac20 26) for a 26 inch door, or (ac20
36)
> > for
> > > a
> > > > 36 inch door.
> > > > 3. Use setvar to control the running osnaps instead of commmand.
> > > > 4. Keep on Lispin'
> > > >
> > > > Mike Weaver
> > > >
> > > >
> > > >
> > > > "David Munoz" wrote in message
> > > > news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> > > > > Ok I know that this routine I'm posting is probably the worst way
to
> > do
> > > > what
> > > > > I want, but since I'm very intermediate at lisp this is the only
way
> I
> > > > could
> > > > > think of.
> > > > >
> > > > > I want to be able to cut a wall (2 lines in 2d representing a
wall,
> > not
> > > > 3d),
> > > > > regardless of its angle and have it cut it at the right size and
put
> > in
> > > > the
> > > > > end caps. Then I want it to make the endcaps the previous
selection
> so
> > > > that
> > > > > I can change the layer to a wall layer all within a menu. I use
this
> > to
> > > > cut
> > > > > openings for doors and windows, put the added wall ends on the
right
> > > > layer,
> > > > > then I have the menu commands take over and insert a door or
window
> > > block
> > > > w/
> > > > > attributes, pause for insertion, pause for changing the attributes
> > > > position
> > > > > and angle, change the layer of the attribute, then put the door on
> the
> > > > right
> > > > > layer.
> > > > >
> > > > > This process works for me up until the wall is at an angle other
> than
> > 0,
> > > > 90,
> > > > > 180, 360. If the wall is at a 45 then it only selects one piece. I
> > tried
> > > > to
> > > > > do a window from one point to another point but it didn't seem to
> > work,
> > > > and
> > > > > neither does doing a fence.
> > > > >
> > > > > So if there is anyone that can help get this working or has a
better
> > way
> > > > of
> > > > > doing this I would GREATLY appreciate it. I can post the menu info
> if
> > > > > necessary so you can see exactly what I'm doing.
> > > > >
> > > > > Thanks,
> > > > > David
> > > > >
> > > > > (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
> > > > > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > > > > os an1 an2 an3 dst dst2 dsz dis osm)
> > > > > (setq osm (getvar "osmode"))
> > > > > (setvar "osmode" 0)
> > > > > (command "undo" "mark")
> > > > > ;GET CORNER/MIDPOINT CHOICE
> > > > > (initget "C M")
> > > > > (if (not CHS)
> > > > > (setq CHS "C"))
> > > > > (setq temp (getkword (strcat "\nInsert Door At The Corner Or
> > Midpoint
> > > Of
> > > > > The Wall? - (C/M): < "chs" > " )))
> > > > > (if temp
> > > > > (setq chs temp))
> > > > >
> > > > > ;EXECUTE CORNER / MIDPOINT
> > > > > (if (= chs "C")
> > > > > (progn
> > > > > (setvar "orthomode" 1)
> > > > > (command "osnap" "int")
> > > > > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > > > > (command "osnap" "near")
> > > > > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
> > > > Location:
> > > > > "))
> > > > > (command "osnap" "per")
> > > > > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened:
> "))
> > > > > (setq ost 3)
> > > > > (princ "\nOffset Distance:<")
> > > > > (princ ost)
> > > > > (setq dis (getdist "> "))
> > > > > (setq ost (if (= dis nil)ost dis))
> > > > > (setq drsz 26)
> > > > > (setq ang1 (angle pt1 pt2))
> > > > > (setq ang2 (angle pt1 pt3))
> > > > > (setq pt4 (polar pt1 ang1 ost))
> > > > > (setq pt5 (polar pt4 ang1 drsz))
> > > > > (setq dist (distance pt1 pt3))
> > > > > (setq pt6 (polar pt4 ang2 dist))
> > > > > (setq pt7 (polar pt6 ang1 drsz))
> > > > > (setvar "osmode" osm)
> > > > > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 ""
> > "line"
> > > > pt4
> > > > > pt6 "")
> > > > > (ssget "w" pt4 pt7))
> > > > > (if (= chs "M")
> > > > > (progn
> > > > > (setvar "orthomode" 1)
> > > > > (command "osnap" "int,midp")
> > > > > (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> > > > > (command "osnap" "per")
> > > > > (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened:
"))
> > > > > (command "osnap" "near")
> > > > > (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb
> > Location:
> > > > "))
> > > > > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
> > > Location:
> > > > > "))
> > > > > (setq dsz 26)
> > > > > (setq os (/ dsz 2))
> > > > > (setq an1 (angle p1 p3))
> > > > > (setq p4 (polar p1 an1 os))
> > > > > (setq an2 (angle p1 hg))
> > > > > (setq p5 (polar p1 an2 os))
> > > > > (setq dst (distance p1 p2))
> > > > > (setq an3 (angle p1 p2))
> > > > > (setq p6 (polar p5 an3 dst))
> > > > > (setq p7 (polar p6 an1 dsz))
> > > > > (setq dst2 (/ dst 2))
> > > > > (setq p8 (polar p5 an3 dst2))
> > > > > (setq p9 (polar p4 an3 dst2))
> > > > > (setvar "osmode" osm)
> > > > > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 "" "line"
p5
> > p6
> > > > "")
> > > > > (ssget "f" (list p8 p9))
> > > > > )
> > > > > )
> > > > > )
> > > > > ) ;end AC20.lsp
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
>
>
Message 9 of 11
Anonymous
in reply to: Anonymous

WOW that works perfect. I did not know that it could be done that way. The
only thing I need a little help understanding is how does it know to set the
value for dsrz to 26. Is it because it is in the local variable section
(drsz / etc.....) and is the only thing not defined? I understand all the
rest of it now, but that's kind of unclear. If that's the case then it would
only be possible to have one instance like that per function, correct?

Once again I have to say thank you VERY much for taking the time to explain
this to me. I really really appreciate it. It has help me a great deal.

Take care,
David

"Mike Weaver" wrote in message
news:98BB3599A9B5BC83DF8CF8D0B7967D74@in.WebX.maYIadrTaRb...
> David,
>
> See the attached.
> The error messages you're getting are telling you a couple of things:
> First the error is due to a bad argument type
> Second, the argument type expected was a list
> Third, the value supplied for the argument - in this case, an entity
name
>
> The append function requires lists for the arguments. So:
> (setq rtlist (append (list (entlast)) rtlist))
> should solve the problem. The attached file does this without using
> append - simply combines the two return values into a list at the end of
the
> routine.
>
> You'll see in the attached file that I have modified ac20 to require a
> single argument - the value for the function drsz - in this case 26.
Also,
> at the end of the procedure, I've added (list en1 en2) so that these
entity
> names will be returned and can be accessed using car and cadr - just as
you
> recognized.
> You go tthe no function definition error because your ac20 function has
the
> leading C:. The only reason for the C: is to make the function available
> without parens. If we are going to be using drsz as an argument we have
to
> enclose it in parens and the C: then does nothing for us.
>
> Supplying the door size (drsz) to the function as an argument allows you
to
> use the same code for all door sizes - no more changing the routines for
> each door size when you have a change.
>
> Mike Weaver
>
>
> "David Munoz" wrote in message
> news:E27F6B51B2A46239421002C9FFAFF217@in.WebX.maYIadrTaRb...
> > Mike,
> > I'm confused again.... I modified the lisp routine to match what you
did,
> > then I added rtlist right before the last closing paren and I got this
> error
> > ; error: bad argument type: listp
> > I took out the rtlist before the last closing paren and it gave me:
> > ; error: bad argument type: listp
> > I took out the (setq rtlist (append rtlist (entlast))) part and get a
nil
> at
> > the end of the routine.
> >
> > I think I understand what you're talking about with the(car jambs) and
> (cadr
> > jambs) but I'm not completely sure.
> > By doing (setq jambs(ac20 26)) is this supposed to execute the ac20 lisp
> and
> > if so what is the 26 for? Now by putting rtlist at
> > the end of the ac20 lisp does that leave the rtlist value available for
> > setting the jambs variable to? That would be why you would step through
> the
> > jambs variable with car and cadr right? Car would extract the first jamb
> and
> > cadr would extract the second jamb right? I can't get (setq jambs(ac20
> 26))
> > or (setq jambs(ac20)) to work. it just gives me ; error: no function
> > definition: AC20. I did (setq jambs(c:ac20)) which executed the ac20
lisp
> > but I still got the above list errors and jambs is set to nil.
> >
> > Once again thanks for taking the time to help me out. I appreciate it.
> >
> > Dave
> >
> >
> > "Mike Weaver" wrote in message
> > news:B449CFD09218E49CD33036845A7377A1@in.WebX.maYIadrTaRb...
> > > David,
> > > I wouldn't use a seelction set. Make your AC20 routine return the
> enames
> > > for the jambs as a list thus:> (command
> > >
> > > "break" pt5 pt4 "break" pt7 pt6)
> > > (command
> > > "line" pt5 pt7 "")
> > > (setq rtlist (list (entlast)))
> > > (command
> > > "line" pt4 pt6 "")
> > > (setq rtlist (append rtlist (entlast)))
> > >
> > > then at the end of your AC20 routine, just before the closing paren
put
> > > rtlist. This will return a list with the entity names of both jambs
to
> > the
> > > calling menu item. Which could be modified as follows to use the
return
> > > value:
> > >
> > >
> > > **Plfldra4_1
> > > [1st Floor AutoCut Door In A 2x4]
> > > [d20l90s4,2068 Left Std]^C^C(setq jambs (ac20
> > > 26));\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > > ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;(car jambs);(cadr
> > > jambs);;la;a1-door;;(menucmd
> > > "gresidential.id_plfldra4_1=|")
> > >
> > >
> > >
> > > Keep at it!
> > >
> > > Mike
> > >
> > > "David Munoz" wrote in message
> > > news:06310A24135AC6674C1ADD32702D3FBE@in.WebX.maYIadrTaRb...
> > > > Thanks for the compliment. Thanks for taking the time to offer some
> > help.
> > > I
> > > > am a little confused with using entlast though. How do I create a
> > > selection
> > > > set of both the line I have drawn? If I do something like this:
> > > >
> > > > (command
> > > > "break" pt5 pt4 "break" pt7 pt6)
> > > > (command
> > > > "line" pt5 pt7 "")
> > > > (setq en1 (entlast))
> > > > (command
> > > > "line" pt4 pt6 "")
> > > > (setq en2 (entlast))
> > > >
> > > > How can I get en1 and en2 to be the previous selection set so that I
> may
> > > > change "previous" to a specific layer once the menu portion takes
> over?
> > > >
> > > > Now if I make the door size an argument to the ac20 function
wouldn't
> I
> > > have
> > > > to have input from the user for a size? I wrote a lisp for every
size
> > that
> > > I
> > > > need just so I could eliminate the user input, other than the
picking
> of
> > > > points.
> > > >
> > > > Here is a small portion of the menu so you can see what I was trying
> to
> > > do.
> > > >
> > > > **Plfldra4_1
> > > > [1st Floor AutoCut Door In A 2x4]
> > > > [d20l90s4,2068 Left
> > > >
> > >
> >
>
Std]^C^Cac20;\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > > >
> >
ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;last;;la;a1-door;;(menucmd
> > > > "gresidential.id_plfldra4_1=|")
> > > >
> > > > Oh wait....never mind I just noticed where I would do that. Well at
> > least
> > > > you can see what I'm trying to do with the "change previous" thing.
> > > >
> > > > Once again thank you very much for the help. I really appreciate it.
> > > >
> > > > Take care,
> > > > David
> > > >
> > > > "Mike Weaver" wrote in message
> > > > news:48728F020942872ACE36496270CF42D6@in.WebX.maYIadrTaRb...
> > > > > David,
> > > > > Pretty good, for someone "very intermediate at lisp".
> > > > > A few suggestions if I might:
> > > > > 1. Use entlast after drawing each jamb. This avoids the
potential
> of
> > > > > selecting undesireable objects.
> > > > > 2. Make your code modular. The code that breaks the lines and
> draws
> > > the
> > > > > jambs is nearly identical. Make this a separate procedure called
by
> > the
> > > > > main routine. Make the door size (dsz) an argument to the ac20
> > function
> > > > > (removing the c:). Then you could call this same function from
your
> > > menu
> > > > to
> > > > > draw multiple door sizes: (ac20 26) for a 26 inch door, or (ac20
> 36)
> > > for
> > > > a
> > > > > 36 inch door.
> > > > > 3. Use setvar to control the running osnaps instead of commmand.
> > > > > 4. Keep on Lispin'
> > > > >
> > > > > Mike Weaver
> > > > >
> > > > >
> > > > >
> > > > > "David Munoz" wrote in message
> > > > > news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> > > > > > Ok I know that this routine I'm posting is probably the worst
way
> to
> > > do
> > > > > what
> > > > > > I want, but since I'm very intermediate at lisp this is the only
> way
> > I
> > > > > could
> > > > > > think of.
> > > > > >
> > > > > > I want to be able to cut a wall (2 lines in 2d representing a
> wall,
> > > not
> > > > > 3d),
> > > > > > regardless of its angle and have it cut it at the right size and
> put
> > > in
> > > > > the
> > > > > > end caps. Then I want it to make the endcaps the previous
> selection
> > so
> > > > > that
> > > > > > I can change the layer to a wall layer all within a menu. I use
> this
> > > to
> > > > > cut
> > > > > > openings for doors and windows, put the added wall ends on the
> right
> > > > > layer,
> > > > > > then I have the menu commands take over and insert a door or
> window
> > > > block
> > > > > w/
> > > > > > attributes, pause for insertion, pause for changing the
attributes
> > > > > position
> > > > > > and angle, change the layer of the attribute, then put the door
on
> > the
> > > > > right
> > > > > > layer.
> > > > > >
> > > > > > This process works for me up until the wall is at an angle other
> > than
> > > 0,
> > > > > 90,
> > > > > > 180, 360. If the wall is at a 45 then it only selects one piece.
I
> > > tried
> > > > > to
> > > > > > do a window from one point to another point but it didn't seem
to
> > > work,
> > > > > and
> > > > > > neither does doing a fence.
> > > > > >
> > > > > > So if there is anyone that can help get this working or has a
> better
> > > way
> > > > > of
> > > > > > doing this I would GREATLY appreciate it. I can post the menu
info
> > if
> > > > > > necessary so you can see exactly what I'm doing.
> > > > > >
> > > > > > Thanks,
> > > > > > David
> > > > > >
> > > > > > (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2
p3
> > > > > > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > > > > > os an1 an2 an3 dst dst2 dsz dis osm)
> > > > > > (setq osm (getvar "osmode"))
> > > > > > (setvar "osmode" 0)
> > > > > > (command "undo" "mark")
> > > > > > ;GET CORNER/MIDPOINT CHOICE
> > > > > > (initget "C M")
> > > > > > (if (not CHS)
> > > > > > (setq CHS "C"))
> > > > > > (setq temp (getkword (strcat "\nInsert Door At The Corner Or
> > > Midpoint
> > > > Of
> > > > > > The Wall? - (C/M): < "chs" > " )))
> > > > > > (if temp
> > > > > > (setq chs temp))
> > > > > >
> > > > > > ;EXECUTE CORNER / MIDPOINT
> > > > > > (if (= chs "C")
> > > > > > (progn
> > > > > > (setvar "orthomode" 1)
> > > > > > (command "osnap" "int")
> > > > > > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > > > > > (command "osnap" "near")
> > > > > > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or
Jamb
> > > > > Location:
> > > > > > "))
> > > > > > (command "osnap" "per")
> > > > > > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be
Opened:
> > "))
> > > > > > (setq ost 3)
> > > > > > (princ "\nOffset Distance:<")
> > > > > > (princ ost)
> > > > > > (setq dis (getdist "> "))
> > > > > > (setq ost (if (= dis nil)ost dis))
> > > > > > (setq drsz 26)
> > > > > > (setq ang1 (angle pt1 pt2))
> > > > > > (setq ang2 (angle pt1 pt3))
> > > > > > (setq pt4 (polar pt1 ang1 ost))
> > > > > > (setq pt5 (polar pt4 ang1 drsz))
> > > > > > (setq dist (distance pt1 pt3))
> > > > > > (setq pt6 (polar pt4 ang2 dist))
> > > > > > (setq pt7 (polar pt6 ang1 drsz))
> > > > > > (setvar "osmode" osm)
> > > > > > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 ""
> > > "line"
> > > > > pt4
> > > > > > pt6 "")
> > > > > > (ssget "w" pt4 pt7))
> > > > > > (if (= chs "M")
> > > > > > (progn
> > > > > > (setvar "orthomode" 1)
> > > > > > (command "osnap" "int,midp")
> > > > > > (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> > > > > > (command "osnap" "per")
> > > > > > (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened:
> "))
> > > > > > (command "osnap" "near")
> > > > > > (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb
> > > Location:
> > > > > "))
> > > > > > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
> > > > Location:
> > > > > > "))
> > > > > > (setq dsz 26)
> > > > > > (setq os (/ dsz 2))
> > > > > > (setq an1 (angle p1 p3))
> > > > > > (setq p4 (polar p1 an1 os))
> > > > > > (setq an2 (angle p1 hg))
> > > > > > (setq p5 (polar p1 an2 os))
> > > > > > (setq dst (distance p1 p2))
> > > > > > (setq an3 (angle p1 p2))
> > > > > > (setq p6 (polar p5 an3 dst))
> > > > > > (setq p7 (polar p6 an1 dsz))
> > > > > > (setq dst2 (/ dst 2))
> > > > > > (setq p8 (polar p5 an3 dst2))
> > > > > > (setq p9 (polar p4 an3 dst2))
> > > > > > (setvar "osmode" osm)
> > > > > > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 ""
"line"
> p5
> > > p6
> > > > > "")
> > > > > > (ssget "f" (list p8 p9))
> > > > > > )
> > > > > > )
> > > > > > )
> > > > > > ) ;end AC20.lsp
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
> >
>
>


----------------------------------------------------------------------------
----


(defun AC20 (drsz / CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
os an1 an2 an3 dst dst2 dsz dis osm en1 en2)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
(command "undo" "mark")
;GET CORNER/MIDPOINT CHOICE
(initget "C M")
(if (not CHS)
(setq CHS "C"))
(setq temp (getkword (strcat "\nInsert Door At The Corner Or Midpoint Of
The Wall? - (C/M): < "chs" > " )))
(if temp
(setq chs temp))

;EXECUTE CORNER / MIDPOINT
(if (= chs "C")
(progn
(setvar "orthomode" 1)
(command "osnap" "int")
(setq pt1 (getpoint "\nSelect Inner Corner: "))
(command "osnap" "near")
(setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
Location:"))
(command "osnap" "per")
(setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened: "))
(setq ost 3)
(princ "\nOffset Distance:<")
(princ ost)
(setq dis (getdist "> "))
(setq ost (if (= dis nil)ost dis))
;;(setq drsz 26)
(setq ang1 (angle pt1 pt2))
(setq ang2 (angle pt1 pt3))
(setq pt4 (polar pt1 ang1 ost))
(setq pt5 (polar pt4 ang1 drsz))
(setq dist (distance pt1 pt3))
(setq pt6 (polar pt4 ang2 dist))
(setq pt7 (polar pt6 ang1 drsz))
(setvar "osmode" osm)
(command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 "")
(setq en1 (entlast))
(command "line" pt4 pt6 "")
(setq en2 (entlast))
)
;;(ssget "w" pt4 pt7))
(if (= chs "M")
(progn
(setvar "orthomode" 1)
(command "osnap" "int,midp")
(setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
(command "osnap" "per")
(setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
(command "osnap" "near")
(setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb Location: "))
(setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
Location:"))
;;(setq dsz 26)
(setq os (/ dsz 2))
(setq an1 (angle p1 p3))
(setq p4 (polar p1 an1 os))
(setq an2 (angle p1 hg))
(setq p5 (polar p1 an2 os))
(setq dst (distance p1 p2))
(setq an3 (angle p1 p2))
(setq p6 (polar p5 an3 dst))
(setq p7 (polar p6 an1 dsz))
(setq dst2 (/ dst 2))
(setq p8 (polar p5 an3 dst2))
(setq p9 (polar p4 an3 dst2))
(setvar "osmode" osm)
(command "break" p4 p5 "break" p7 p6 "line" p4 p7 "")
(setq en1 (entlast))
(command "line" p5 p6 "")
(setq en2 (entlast))
;;(ssget "f" (list p8 p9))
)
)
)
(list en1 en2)
) ;end AC20.lsp
Message 10 of 11
Anonymous
in reply to: Anonymous

I'm glad it works!

The local variables section has two areas separated by the foreward slash.
The vars in the first area are declared arguments, those in the second are
localized vars. For example:

(defun test(arg1 arg2 / var1 var2)
(princ (strcat "\n" arg1 "\t" arg2))
(princ)
)

defines arg1 and arg2 as arguments, var1 and var2 as local variables. When
calling this function, you have to supply values for arg1 and arg2 as
follows:

(test "Value for first argument" "value for second argument")
will print:

Value for first argument value for second argument

So. For your AC20 routine, you can draw 26 inch doors with: (ac20 26) and
36 inch doors with (ac20 36). You can now draw any width door with that
single routine - no need for different routines for each door width.

I create nearly all of my sub-routines to take required input as arguments
and return some value to the calling routine. I very seldom use global
variables for passing information between routines.

Mike Weaver


"David Munoz" wrote in message
news:9BCC5ACAA21739FBE4625CA449D77F16@in.WebX.maYIadrTaRb...
> WOW that works perfect. I did not know that it could be done that way. The
> only thing I need a little help understanding is how does it know to set
the
> value for dsrz to 26. Is it because it is in the local variable section
> (drsz / etc.....) and is the only thing not defined? I understand all the
> rest of it now, but that's kind of unclear. If that's the case then it
would
> only be possible to have one instance like that per function, correct?
>
> Once again I have to say thank you VERY much for taking the time to
explain
> this to me. I really really appreciate it. It has help me a great deal.
>
> Take care,
> David
>
> "Mike Weaver" wrote in message
> news:98BB3599A9B5BC83DF8CF8D0B7967D74@in.WebX.maYIadrTaRb...
> > David,
> >
> > See the attached.
> > The error messages you're getting are telling you a couple of things:
> > First the error is due to a bad argument type
> > Second, the argument type expected was a list
> > Third, the value supplied for the argument - in this case, an entity
> name
> >
> > The append function requires lists for the arguments. So:
> > (setq rtlist (append (list (entlast)) rtlist))
> > should solve the problem. The attached file does this without using
> > append - simply combines the two return values into a list at the end of
> the
> > routine.
> >
> > You'll see in the attached file that I have modified ac20 to require a
> > single argument - the value for the function drsz - in this case 26.
> Also,
> > at the end of the procedure, I've added (list en1 en2) so that these
> entity
> > names will be returned and can be accessed using car and cadr - just as
> you
> > recognized.
> > You go tthe no function definition error because your ac20 function has
> the
> > leading C:. The only reason for the C: is to make the function
available
> > without parens. If we are going to be using drsz as an argument we have
> to
> > enclose it in parens and the C: then does nothing for us.
> >
> > Supplying the door size (drsz) to the function as an argument allows you
> to
> > use the same code for all door sizes - no more changing the routines for
> > each door size when you have a change.
> >
> > Mike Weaver
> >
> >
> > "David Munoz" wrote in message
> > news:E27F6B51B2A46239421002C9FFAFF217@in.WebX.maYIadrTaRb...
> > > Mike,
> > > I'm confused again.... I modified the lisp routine to match what you
> did,
> > > then I added rtlist right before the last closing paren and I got this
> > error
> > > ; error: bad argument type: listp
> > > I took out the rtlist before the last closing paren and it gave me:
> > > ; error: bad argument type: listp
> > > I took out the (setq rtlist (append rtlist (entlast))) part and get a
> nil
> > at
> > > the end of the routine.
> > >
> > > I think I understand what you're talking about with the(car jambs) and
> > (cadr
> > > jambs) but I'm not completely sure.
> > > By doing (setq jambs(ac20 26)) is this supposed to execute the ac20
lisp
> > and
> > > if so what is the 26 for? Now by putting rtlist at
> > > the end of the ac20 lisp does that leave the rtlist value available
for
> > > setting the jambs variable to? That would be why you would step
through
> > the
> > > jambs variable with car and cadr right? Car would extract the first
jamb
> > and
> > > cadr would extract the second jamb right? I can't get (setq jambs(ac20
> > 26))
> > > or (setq jambs(ac20)) to work. it just gives me ; error: no function
> > > definition: AC20. I did (setq jambs(c:ac20)) which executed the ac20
> lisp
> > > but I still got the above list errors and jambs is set to nil.
> > >
> > > Once again thanks for taking the time to help me out. I appreciate it.
> > >
> > > Dave
> > >
> > >
> > > "Mike Weaver" wrote in message
> > > news:B449CFD09218E49CD33036845A7377A1@in.WebX.maYIadrTaRb...
> > > > David,
> > > > I wouldn't use a seelction set. Make your AC20 routine return the
> > enames
> > > > for the jambs as a list thus:> (command
> > > >
> > > > "break" pt5 pt4 "break" pt7 pt6)
> > > > (command
> > > > "line" pt5 pt7 "")
> > > > (setq rtlist (list (entlast)))
> > > > (command
> > > > "line" pt4 pt6 "")
> > > > (setq rtlist (append rtlist (entlast)))
> > > >
> > > > then at the end of your AC20 routine, just before the closing paren
> put
> > > > rtlist. This will return a list with the entity names of both jambs
> to
> > > the
> > > > calling menu item. Which could be modified as follows to use the
> return
> > > > value:
> > > >
> > > >
> > > > **Plfldra4_1
> > > > [1st Floor AutoCut Door In A 2x4]
> > > > [d20l90s4,2068 Left Std]^C^C(setq jambs (ac20
> > > > 26));\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > > > ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;(car jambs);(cadr
> > > > jambs);;la;a1-door;;(menucmd
> > > > "gresidential.id_plfldra4_1=|")
> > > >
> > > >
> > > >
> > > > Keep at it!
> > > >
> > > > Mike
> > > >
> > > > "David Munoz" wrote in message
> > > > news:06310A24135AC6674C1ADD32702D3FBE@in.WebX.maYIadrTaRb...
> > > > > Thanks for the compliment. Thanks for taking the time to offer
some
> > > help.
> > > > I
> > > > > am a little confused with using entlast though. How do I create a
> > > > selection
> > > > > set of both the line I have drawn? If I do something like this:
> > > > >
> > > > > (command
> > > > > "break" pt5 pt4 "break" pt7 pt6)
> > > > > (command
> > > > > "line" pt5 pt7 "")
> > > > > (setq en1 (entlast))
> > > > > (command
> > > > > "line" pt4 pt6 "")
> > > > > (setq en2 (entlast))
> > > > >
> > > > > How can I get en1 and en2 to be the previous selection set so that
I
> > may
> > > > > change "previous" to a specific layer once the menu portion takes
> > over?
> > > > >
> > > > > Now if I make the door size an argument to the ac20 function
> wouldn't
> > I
> > > > have
> > > > > to have input from the user for a size? I wrote a lisp for every
> size
> > > that
> > > > I
> > > > > need just so I could eliminate the user input, other than the
> picking
> > of
> > > > > points.
> > > > >
> > > > > Here is a small portion of the menu so you can see what I was
trying
> > to
> > > > do.
> > > > >
> > > > > **Plfldra4_1
> > > > > [1st Floor AutoCut Door In A 2x4]
> > > > > [d20l90s4,2068 Left
> > > > >
> > > >
> > >
> >
>
Std]^C^Cac20;\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > > > >
> > >
> ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;last;;la;a1-door;;(menucmd
> > > > > "gresidential.id_plfldra4_1=|")
> > > > >
> > > > > Oh wait....never mind I just noticed where I would do that. Well
at
> > > least
> > > > > you can see what I'm trying to do with the "change previous"
thing.
> > > > >
> > > > > Once again thank you very much for the help. I really appreciate
it.
> > > > >
> > > > > Take care,
> > > > > David
> > > > >
> > > > > "Mike Weaver" wrote in message
> > > > > news:48728F020942872ACE36496270CF42D6@in.WebX.maYIadrTaRb...
> > > > > > David,
> > > > > > Pretty good, for someone "very intermediate at lisp".
> > > > > > A few suggestions if I might:
> > > > > > 1. Use entlast after drawing each jamb. This avoids the
> potential
> > of
> > > > > > selecting undesireable objects.
> > > > > > 2. Make your code modular. The code that breaks the lines and
> > draws
> > > > the
> > > > > > jambs is nearly identical. Make this a separate procedure
called
> by
> > > the
> > > > > > main routine. Make the door size (dsz) an argument to the ac20
> > > function
> > > > > > (removing the c:). Then you could call this same function from
> your
> > > > menu
> > > > > to
> > > > > > draw multiple door sizes: (ac20 26) for a 26 inch door, or
(ac20
> > 36)
> > > > for
> > > > > a
> > > > > > 36 inch door.
> > > > > > 3. Use setvar to control the running osnaps instead of
commmand.
> > > > > > 4. Keep on Lispin'
> > > > > >
> > > > > > Mike Weaver
> > > > > >
> > > > > >
> > > > > >
> > > > > > "David Munoz" wrote in message
> > > > > > news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> > > > > > > Ok I know that this routine I'm posting is probably the worst
> way
> > to
> > > > do
> > > > > > what
> > > > > > > I want, but since I'm very intermediate at lisp this is the
only
> > way
> > > I
> > > > > > could
> > > > > > > think of.
> > > > > > >
> > > > > > > I want to be able to cut a wall (2 lines in 2d representing a
> > wall,
> > > > not
> > > > > > 3d),
> > > > > > > regardless of its angle and have it cut it at the right size
and
> > put
> > > > in
> > > > > > the
> > > > > > > end caps. Then I want it to make the endcaps the previous
> > selection
> > > so
> > > > > > that
> > > > > > > I can change the layer to a wall layer all within a menu. I
use
> > this
> > > > to
> > > > > > cut
> > > > > > > openings for doors and windows, put the added wall ends on the
> > right
> > > > > > layer,
> > > > > > > then I have the menu commands take over and insert a door or
> > window
> > > > > block
> > > > > > w/
> > > > > > > attributes, pause for insertion, pause for changing the
> attributes
> > > > > > position
> > > > > > > and angle, change the layer of the attribute, then put the
door
> on
> > > the
> > > > > > right
> > > > > > > layer.
> > > > > > >
> > > > > > > This process works for me up until the wall is at an angle
other
> > > than
> > > > 0,
> > > > > > 90,
> > > > > > > 180, 360. If the wall is at a 45 then it only selects one
piece.
> I
> > > > tried
> > > > > > to
> > > > > > > do a window from one point to another point but it didn't seem
> to
> > > > work,
> > > > > > and
> > > > > > > neither does doing a fence.
> > > > > > >
> > > > > > > So if there is anyone that can help get this working or has a
> > better
> > > > way
> > > > > > of
> > > > > > > doing this I would GREATLY appreciate it. I can post the menu
> info
> > > if
> > > > > > > necessary so you can see exactly what I'm doing.
> > > > > > >
> > > > > > > Thanks,
> > > > > > > David
> > > > > > >
> > > > > > > (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2
> p3
> > > > > > > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > > > > > > os an1 an2 an3 dst dst2 dsz dis osm)
> > > > > > > (setq osm (getvar "osmode"))
> > > > > > > (setvar "osmode" 0)
> > > > > > > (command "undo" "mark")
> > > > > > > ;GET CORNER/MIDPOINT CHOICE
> > > > > > > (initget "C M")
> > > > > > > (if (not CHS)
> > > > > > > (setq CHS "C"))
> > > > > > > (setq temp (getkword (strcat "\nInsert Door At The Corner Or
> > > > Midpoint
> > > > > Of
> > > > > > > The Wall? - (C/M): < "chs" > " )))
> > > > > > > (if temp
> > > > > > > (setq chs temp))
> > > > > > >
> > > > > > > ;EXECUTE CORNER / MIDPOINT
> > > > > > > (if (= chs "C")
> > > > > > > (progn
> > > > > > > (setvar "orthomode" 1)
> > > > > > > (command "osnap" "int")
> > > > > > > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > > > > > > (command "osnap" "near")
> > > > > > > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or
> Jamb
> > > > > > Location:
> > > > > > > "))
> > > > > > > (command "osnap" "per")
> > > > > > > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be
> Opened:
> > > "))
> > > > > > > (setq ost 3)
> > > > > > > (princ "\nOffset Distance:<")
> > > > > > > (princ ost)
> > > > > > > (setq dis (getdist "> "))
> > > > > > > (setq ost (if (= dis nil)ost dis))
> > > > > > > (setq drsz 26)
> > > > > > > (setq ang1 (angle pt1 pt2))
> > > > > > > (setq ang2 (angle pt1 pt3))
> > > > > > > (setq pt4 (polar pt1 ang1 ost))
> > > > > > > (setq pt5 (polar pt4 ang1 drsz))
> > > > > > > (setq dist (distance pt1 pt3))
> > > > > > > (setq pt6 (polar pt4 ang2 dist))
> > > > > > > (setq pt7 (polar pt6 ang1 drsz))
> > > > > > > (setvar "osmode" osm)
> > > > > > > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7
""
> > > > "line"
> > > > > > pt4
> > > > > > > pt6 "")
> > > > > > > (ssget "w" pt4 pt7))
> > > > > > > (if (= chs "M")
> > > > > > > (progn
> > > > > > > (setvar "orthomode" 1)
> > > > > > > (command "osnap" "int,midp")
> > > > > > > (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> > > > > > > (command "osnap" "per")
> > > > > > > (setq p2 (getpoint p1 "\nSelect Outside Face To Be
Opened:
> > "))
> > > > > > > (command "osnap" "near")
> > > > > > > (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb
> > > > Location:
> > > > > > "))
> > > > > > > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or
Jamb
> > > > > Location:
> > > > > > > "))
> > > > > > > (setq dsz 26)
> > > > > > > (setq os (/ dsz 2))
> > > > > > > (setq an1 (angle p1 p3))
> > > > > > > (setq p4 (polar p1 an1 os))
> > > > > > > (setq an2 (angle p1 hg))
> > > > > > > (setq p5 (polar p1 an2 os))
> > > > > > > (setq dst (distance p1 p2))
> > > > > > > (setq an3 (angle p1 p2))
> > > > > > > (setq p6 (polar p5 an3 dst))
> > > > > > > (setq p7 (polar p6 an1 dsz))
> > > > > > > (setq dst2 (/ dst 2))
> > > > > > > (setq p8 (polar p5 an3 dst2))
> > > > > > > (setq p9 (polar p4 an3 dst2))
> > > > > > > (setvar "osmode" osm)
> > > > > > > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 ""
> "line"
> > p5
> > > > p6
> > > > > > "")
> > > > > > > (ssget "f" (list p8 p9))
> > > > > > > )
> > > > > > > )
> > > > > > > )
> > > > > > > ) ;end AC20.lsp
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
> >
>
>
> --------------------------------------------------------------------------
--
> ----
>
>
> (defun AC20 (drsz / CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
> p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> os an1 an2 an3 dst dst2 dsz dis osm en1 en2)
> (setq osm (getvar "osmode"))
> (setvar "osmode" 0)
> (command "undo" "mark")
> ;GET CORNER/MIDPOINT CHOICE
> (initget "C M")
> (if (not CHS)
> (setq CHS "C"))
> (setq temp (getkword (strcat "\nInsert Door At The Corner Or Midpoint Of
> The Wall? - (C/M): < "chs" > " )))
> (if temp
> (setq chs temp))
>
> ;EXECUTE CORNER / MIDPOINT
> (if (= chs "C")
> (progn
> (setvar "orthomode" 1)
> (command "osnap" "int")
> (setq pt1 (getpoint "\nSelect Inner Corner: "))
> (command "osnap" "near")
> (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
> Location:"))
> (command "osnap" "per")
> (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened: "))
> (setq ost 3)
> (princ "\nOffset Distance:<")
> (princ ost)
> (setq dis (getdist "> "))
> (setq ost (if (= dis nil)ost dis))
> ;;(setq drsz 26)
> (setq ang1 (angle pt1 pt2))
> (setq ang2 (angle pt1 pt3))
> (setq pt4 (polar pt1 ang1 ost))
> (setq pt5 (polar pt4 ang1 drsz))
> (setq dist (distance pt1 pt3))
> (setq pt6 (polar pt4 ang2 dist))
> (setq pt7 (polar pt6 ang1 drsz))
> (setvar "osmode" osm)
> (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 "")
> (setq en1 (entlast))
> (command "line" pt4 pt6 "")
> (setq en2 (entlast))
> )
> ;;(ssget "w" pt4 pt7))
> (if (= chs "M")
> (progn
> (setvar "orthomode" 1)
> (command "osnap" "int,midp")
> (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> (command "osnap" "per")
> (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
> (command "osnap" "near")
> (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb Location:
"))
> (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
> Location:"))
> ;;(setq dsz 26)
> (setq os (/ dsz 2))
> (setq an1 (angle p1 p3))
> (setq p4 (polar p1 an1 os))
> (setq an2 (angle p1 hg))
> (setq p5 (polar p1 an2 os))
> (setq dst (distance p1 p2))
> (setq an3 (angle p1 p2))
> (setq p6 (polar p5 an3 dst))
> (setq p7 (polar p6 an1 dsz))
> (setq dst2 (/ dst 2))
> (setq p8 (polar p5 an3 dst2))
> (setq p9 (polar p4 an3 dst2))
> (setvar "osmode" osm)
> (command "break" p4 p5 "break" p7 p6 "line" p4 p7 "")
> (setq en1 (entlast))
> (command "line" p5 p6 "")
> (setq en2 (entlast))
> ;;(ssget "f" (list p8 p9))
> )
> )
> )
> (list en1 en2)
> ) ;end AC20.lsp
>
>
>
>
Message 11 of 11
Anonymous
in reply to: Anonymous

Well that pretty much clears it up. Thanks a whole bunch. I have learned a
great deal from this.

Well.........take care, and as you said before....Keep on lispin'
Dave Munoz

"Mike Weaver" wrote in message
news:E367027836D819809FECED10EEA9F6D7@in.WebX.maYIadrTaRb...
> I'm glad it works!
>
> The local variables section has two areas separated by the foreward slash.
> The vars in the first area are declared arguments, those in the second are
> localized vars. For example:
>
> (defun test(arg1 arg2 / var1 var2)
> (princ (strcat "\n" arg1 "\t" arg2))
> (princ)
> )
>
> defines arg1 and arg2 as arguments, var1 and var2 as local variables.
When
> calling this function, you have to supply values for arg1 and arg2 as
> follows:
>
> (test "Value for first argument" "value for second argument")
> will print:
>
> Value for first argument value for second argument
>
> So. For your AC20 routine, you can draw 26 inch doors with: (ac20 26) and
> 36 inch doors with (ac20 36). You can now draw any width door with that
> single routine - no need for different routines for each door width.
>
> I create nearly all of my sub-routines to take required input as arguments
> and return some value to the calling routine. I very seldom use global
> variables for passing information between routines.
>
> Mike Weaver
>
>
> "David Munoz" wrote in message
> news:9BCC5ACAA21739FBE4625CA449D77F16@in.WebX.maYIadrTaRb...
> > WOW that works perfect. I did not know that it could be done that way.
The
> > only thing I need a little help understanding is how does it know to set
> the
> > value for dsrz to 26. Is it because it is in the local variable section
> > (drsz / etc.....) and is the only thing not defined? I understand all
the
> > rest of it now, but that's kind of unclear. If that's the case then it
> would
> > only be possible to have one instance like that per function, correct?
> >
> > Once again I have to say thank you VERY much for taking the time to
> explain
> > this to me. I really really appreciate it. It has help me a great deal.
> >
> > Take care,
> > David
> >
> > "Mike Weaver" wrote in message
> > news:98BB3599A9B5BC83DF8CF8D0B7967D74@in.WebX.maYIadrTaRb...
> > > David,
> > >
> > > See the attached.
> > > The error messages you're getting are telling you a couple of things:
> > > First the error is due to a bad argument type
> > > Second, the argument type expected was a list
> > > Third, the value supplied for the argument - in this case, an
entity
> > name
> > >
> > > The append function requires lists for the arguments. So:
> > > (setq rtlist (append (list (entlast)) rtlist))
> > > should solve the problem. The attached file does this without using
> > > append - simply combines the two return values into a list at the end
of
> > the
> > > routine.
> > >
> > > You'll see in the attached file that I have modified ac20 to require a
> > > single argument - the value for the function drsz - in this case 26.
> > Also,
> > > at the end of the procedure, I've added (list en1 en2) so that these
> > entity
> > > names will be returned and can be accessed using car and cadr - just
as
> > you
> > > recognized.
> > > You go tthe no function definition error because your ac20 function
has
> > the
> > > leading C:. The only reason for the C: is to make the function
> available
> > > without parens. If we are going to be using drsz as an argument we
have
> > to
> > > enclose it in parens and the C: then does nothing for us.
> > >
> > > Supplying the door size (drsz) to the function as an argument allows
you
> > to
> > > use the same code for all door sizes - no more changing the routines
for
> > > each door size when you have a change.
> > >
> > > Mike Weaver
> > >
> > >
> > > "David Munoz" wrote in message
> > > news:E27F6B51B2A46239421002C9FFAFF217@in.WebX.maYIadrTaRb...
> > > > Mike,
> > > > I'm confused again.... I modified the lisp routine to match what you
> > did,
> > > > then I added rtlist right before the last closing paren and I got
this
> > > error
> > > > ; error: bad argument type: listp
> > > > I took out the rtlist before the last closing paren and it gave me:
> > > > ; error: bad argument type: listp
> > > > I took out the (setq rtlist (append rtlist (entlast))) part and get
a
> > nil
> > > at
> > > > the end of the routine.
> > > >
> > > > I think I understand what you're talking about with the(car jambs)
and
> > > (cadr
> > > > jambs) but I'm not completely sure.
> > > > By doing (setq jambs(ac20 26)) is this supposed to execute the ac20
> lisp
> > > and
> > > > if so what is the 26 for? Now by putting rtlist at
> > > > the end of the ac20 lisp does that leave the rtlist value available
> for
> > > > setting the jambs variable to? That would be why you would step
> through
> > > the
> > > > jambs variable with car and cadr right? Car would extract the first
> jamb
> > > and
> > > > cadr would extract the second jamb right? I can't get (setq
jambs(ac20
> > > 26))
> > > > or (setq jambs(ac20)) to work. it just gives me ; error: no function
> > > > definition: AC20. I did (setq jambs(c:ac20)) which executed the ac20
> > lisp
> > > > but I still got the above list errors and jambs is set to nil.
> > > >
> > > > Once again thanks for taking the time to help me out. I appreciate
it.
> > > >
> > > > Dave
> > > >
> > > >
> > > > "Mike Weaver" wrote in message
> > > > news:B449CFD09218E49CD33036845A7377A1@in.WebX.maYIadrTaRb...
> > > > > David,
> > > > > I wouldn't use a seelction set. Make your AC20 routine return the
> > > enames
> > > > > for the jambs as a list thus:> (command
> > > > >
> > > > > "break" pt5 pt4 "break" pt7 pt6)
> > > > > (command
> > > > > "line" pt5 pt7 "")
> > > > > (setq rtlist (list (entlast)))
> > > > > (command
> > > > > "line" pt4 pt6 "")
> > > > > (setq rtlist (append rtlist (entlast)))
> > > > >
> > > > > then at the end of your AC20 routine, just before the closing
paren
> > put
> > > > > rtlist. This will return a list with the entity names of both
jambs
> > to
> > > > the
> > > > > calling menu item. Which could be modified as follows to use the
> > return
> > > > > value:
> > > > >
> > > > >
> > > > > **Plfldra4_1
> > > > > [1st Floor AutoCut Door In A 2x4]
> > > > > [d20l90s4,2068 Left Std]^C^C(setq jambs (ac20
> > > > >
26));\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > > > > ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;(car jambs);(cadr
> > > > > jambs);;la;a1-door;;(menucmd
> > > > > "gresidential.id_plfldra4_1=|")
> > > > >
> > > > >
> > > > >
> > > > > Keep at it!
> > > > >
> > > > > Mike
> > > > >
> > > > > "David Munoz" wrote in message
> > > > > news:06310A24135AC6674C1ADD32702D3FBE@in.WebX.maYIadrTaRb...
> > > > > > Thanks for the compliment. Thanks for taking the time to offer
> some
> > > > help.
> > > > > I
> > > > > > am a little confused with using entlast though. How do I create
a
> > > > > selection
> > > > > > set of both the line I have drawn? If I do something like this:
> > > > > >
> > > > > > (command
> > > > > > "break" pt5 pt4 "break" pt7 pt6)
> > > > > > (command
> > > > > > "line" pt5 pt7 "")
> > > > > > (setq en1 (entlast))
> > > > > > (command
> > > > > > "line" pt4 pt6 "")
> > > > > > (setq en2 (entlast))
> > > > > >
> > > > > > How can I get en1 and en2 to be the previous selection set so
that
> I
> > > may
> > > > > > change "previous" to a specific layer once the menu portion
takes
> > > over?
> > > > > >
> > > > > > Now if I make the door size an argument to the ac20 function
> > wouldn't
> > > I
> > > > > have
> > > > > > to have input from the user for a size? I wrote a lisp for every
> > size
> > > > that
> > > > > I
> > > > > > need just so I could eliminate the user input, other than the
> > picking
> > > of
> > > > > > points.
> > > > > >
> > > > > > Here is a small portion of the menu so you can see what I was
> trying
> > > to
> > > > > do.
> > > > > >
> > > > > > **Plfldra4_1
> > > > > > [1st Floor AutoCut Door In A 2x4]
> > > > > > [d20l90s4,2068 Left
> > > > > >
> > > > >
> > > >
> > >
> >
>
Std]^C^Cac20;\\\\\chprop;pre;;la;a1-wall-full;;-insert;d20l90s4;endp;\;;\;-a
> > > > > >
> > > >
> >
ttedit;;;;;last;;a;\p;\la;a1-anno-note;;chprop;last;;la;a1-door;;(menucmd
> > > > > > "gresidential.id_plfldra4_1=|")
> > > > > >
> > > > > > Oh wait....never mind I just noticed where I would do that. Well
> at
> > > > least
> > > > > > you can see what I'm trying to do with the "change previous"
> thing.
> > > > > >
> > > > > > Once again thank you very much for the help. I really appreciate
> it.
> > > > > >
> > > > > > Take care,
> > > > > > David
> > > > > >
> > > > > > "Mike Weaver" wrote in message
> > > > > > news:48728F020942872ACE36496270CF42D6@in.WebX.maYIadrTaRb...
> > > > > > > David,
> > > > > > > Pretty good, for someone "very intermediate at lisp".
> > > > > > > A few suggestions if I might:
> > > > > > > 1. Use entlast after drawing each jamb. This avoids the
> > potential
> > > of
> > > > > > > selecting undesireable objects.
> > > > > > > 2. Make your code modular. The code that breaks the lines
and
> > > draws
> > > > > the
> > > > > > > jambs is nearly identical. Make this a separate procedure
> called
> > by
> > > > the
> > > > > > > main routine. Make the door size (dsz) an argument to the
ac20
> > > > function
> > > > > > > (removing the c:). Then you could call this same function
from
> > your
> > > > > menu
> > > > > > to
> > > > > > > draw multiple door sizes: (ac20 26) for a 26 inch door, or
> (ac20
> > > 36)
> > > > > for
> > > > > > a
> > > > > > > 36 inch door.
> > > > > > > 3. Use setvar to control the running osnaps instead of
> commmand.
> > > > > > > 4. Keep on Lispin'
> > > > > > >
> > > > > > > Mike Weaver
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > "David Munoz" wrote in message
> > > > > > > news:637E104ACCB07141C0A2B61038147B45@in.WebX.maYIadrTaRb...
> > > > > > > > Ok I know that this routine I'm posting is probably the
worst
> > way
> > > to
> > > > > do
> > > > > > > what
> > > > > > > > I want, but since I'm very intermediate at lisp this is the
> only
> > > way
> > > > I
> > > > > > > could
> > > > > > > > think of.
> > > > > > > >
> > > > > > > > I want to be able to cut a wall (2 lines in 2d representing
a
> > > wall,
> > > > > not
> > > > > > > 3d),
> > > > > > > > regardless of its angle and have it cut it at the right size
> and
> > > put
> > > > > in
> > > > > > > the
> > > > > > > > end caps. Then I want it to make the endcaps the previous
> > > selection
> > > > so
> > > > > > > that
> > > > > > > > I can change the layer to a wall layer all within a menu. I
> use
> > > this
> > > > > to
> > > > > > > cut
> > > > > > > > openings for doors and windows, put the added wall ends on
the
> > > right
> > > > > > > layer,
> > > > > > > > then I have the menu commands take over and insert a door or
> > > window
> > > > > > block
> > > > > > > w/
> > > > > > > > attributes, pause for insertion, pause for changing the
> > attributes
> > > > > > > position
> > > > > > > > and angle, change the layer of the attribute, then put the
> door
> > on
> > > > the
> > > > > > > right
> > > > > > > > layer.
> > > > > > > >
> > > > > > > > This process works for me up until the wall is at an angle
> other
> > > > than
> > > > > 0,
> > > > > > > 90,
> > > > > > > > 180, 360. If the wall is at a 45 then it only selects one
> piece.
> > I
> > > > > tried
> > > > > > > to
> > > > > > > > do a window from one point to another point but it didn't
seem
> > to
> > > > > work,
> > > > > > > and
> > > > > > > > neither does doing a fence.
> > > > > > > >
> > > > > > > > So if there is anyone that can help get this working or has
a
> > > better
> > > > > way
> > > > > > > of
> > > > > > > > doing this I would GREATLY appreciate it. I can post the
menu
> > info
> > > > if
> > > > > > > > necessary so you can see exactly what I'm doing.
> > > > > > > >
> > > > > > > > Thanks,
> > > > > > > > David
> > > > > > > >
> > > > > > > > (defun C:AC20 (/ CHS pt1 pt2 pt3 pt5 pt6 pt7 p1
p2
> > p3
> > > > > > > > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > > > > > > > os an1 an2 an3 dst dst2 dsz dis osm)
> > > > > > > > (setq osm (getvar "osmode"))
> > > > > > > > (setvar "osmode" 0)
> > > > > > > > (command "undo" "mark")
> > > > > > > > ;GET CORNER/MIDPOINT CHOICE
> > > > > > > > (initget "C M")
> > > > > > > > (if (not CHS)
> > > > > > > > (setq CHS "C"))
> > > > > > > > (setq temp (getkword (strcat "\nInsert Door At The Corner
Or
> > > > > Midpoint
> > > > > > Of
> > > > > > > > The Wall? - (C/M): < "chs" > " )))
> > > > > > > > (if temp
> > > > > > > > (setq chs temp))
> > > > > > > >
> > > > > > > > ;EXECUTE CORNER / MIDPOINT
> > > > > > > > (if (= chs "C")
> > > > > > > > (progn
> > > > > > > > (setvar "orthomode" 1)
> > > > > > > > (command "osnap" "int")
> > > > > > > > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > > > > > > > (command "osnap" "near")
> > > > > > > > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike
Or
> > Jamb
> > > > > > > Location:
> > > > > > > > "))
> > > > > > > > (command "osnap" "per")
> > > > > > > > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be
> > Opened:
> > > > "))
> > > > > > > > (setq ost 3)
> > > > > > > > (princ "\nOffset Distance:<")
> > > > > > > > (princ ost)
> > > > > > > > (setq dis (getdist "> "))
> > > > > > > > (setq ost (if (= dis nil)ost dis))
> > > > > > > > (setq drsz 26)
> > > > > > > > (setq ang1 (angle pt1 pt2))
> > > > > > > > (setq ang2 (angle pt1 pt3))
> > > > > > > > (setq pt4 (polar pt1 ang1 ost))
> > > > > > > > (setq pt5 (polar pt4 ang1 drsz))
> > > > > > > > (setq dist (distance pt1 pt3))
> > > > > > > > (setq pt6 (polar pt4 ang2 dist))
> > > > > > > > (setq pt7 (polar pt6 ang1 drsz))
> > > > > > > > (setvar "osmode" osm)
> > > > > > > > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5
pt7
> ""
> > > > > "line"
> > > > > > > pt4
> > > > > > > > pt6 "")
> > > > > > > > (ssget "w" pt4 pt7))
> > > > > > > > (if (= chs "M")
> > > > > > > > (progn
> > > > > > > > (setvar "orthomode" 1)
> > > > > > > > (command "osnap" "int,midp")
> > > > > > > > (setq p1 (getpoint "\nSelect Intersection/Midpoint:
"))
> > > > > > > > (command "osnap" "per")
> > > > > > > > (setq p2 (getpoint p1 "\nSelect Outside Face To Be
> Opened:
> > > "))
> > > > > > > > (command "osnap" "near")
> > > > > > > > (setq hg (getpoint p1 "\nSelect Approximate Hing Or
Jamb
> > > > > Location:
> > > > > > > "))
> > > > > > > > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or
> Jamb
> > > > > > Location:
> > > > > > > > "))
> > > > > > > > (setq dsz 26)
> > > > > > > > (setq os (/ dsz 2))
> > > > > > > > (setq an1 (angle p1 p3))
> > > > > > > > (setq p4 (polar p1 an1 os))
> > > > > > > > (setq an2 (angle p1 hg))
> > > > > > > > (setq p5 (polar p1 an2 os))
> > > > > > > > (setq dst (distance p1 p2))
> > > > > > > > (setq an3 (angle p1 p2))
> > > > > > > > (setq p6 (polar p5 an3 dst))
> > > > > > > > (setq p7 (polar p6 an1 dsz))
> > > > > > > > (setq dst2 (/ dst 2))
> > > > > > > > (setq p8 (polar p5 an3 dst2))
> > > > > > > > (setq p9 (polar p4 an3 dst2))
> > > > > > > > (setvar "osmode" osm)
> > > > > > > > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 ""
> > "line"
> > > p5
> > > > > p6
> > > > > > > "")
> > > > > > > > (ssget "f" (list p8 p9))
> > > > > > > > )
> > > > > > > > )
> > > > > > > > )
> > > > > > > > ) ;end AC20.lsp
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
> --------------------------------------------------------------------------
> --
> > ----
> >
> >
> > (defun AC20 (drsz / CHS pt1 pt2 pt3 pt5 pt6 pt7 p1 p2 p3
> > p4 p6 p7 p8 p9 ost ang1 ang2 dist drsz hg
> > os an1 an2 an3 dst dst2 dsz dis osm en1 en2)
> > (setq osm (getvar "osmode"))
> > (setvar "osmode" 0)
> > (command "undo" "mark")
> > ;GET CORNER/MIDPOINT CHOICE
> > (initget "C M")
> > (if (not CHS)
> > (setq CHS "C"))
> > (setq temp (getkword (strcat "\nInsert Door At The Corner Or Midpoint
Of
> > The Wall? - (C/M): < "chs" > " )))
> > (if temp
> > (setq chs temp))
> >
> > ;EXECUTE CORNER / MIDPOINT
> > (if (= chs "C")
> > (progn
> > (setvar "orthomode" 1)
> > (command "osnap" "int")
> > (setq pt1 (getpoint "\nSelect Inner Corner: "))
> > (command "osnap" "near")
> > (setq pt2 (getpoint pt1 "\nSelect Approximate Strike Or Jamb
> > Location:"))
> > (command "osnap" "per")
> > (setq pt3 (getpoint pt1 "\nSelect Outside Face To Be Opened: "))
> > (setq ost 3)
> > (princ "\nOffset Distance:<")
> > (princ ost)
> > (setq dis (getdist "> "))
> > (setq ost (if (= dis nil)ost dis))
> > ;;(setq drsz 26)
> > (setq ang1 (angle pt1 pt2))
> > (setq ang2 (angle pt1 pt3))
> > (setq pt4 (polar pt1 ang1 ost))
> > (setq pt5 (polar pt4 ang1 drsz))
> > (setq dist (distance pt1 pt3))
> > (setq pt6 (polar pt4 ang2 dist))
> > (setq pt7 (polar pt6 ang1 drsz))
> > (setvar "osmode" osm)
> > (command "break" pt5 pt4 "break" pt7 pt6 "line" pt5 pt7 "")
> > (setq en1 (entlast))
> > (command "line" pt4 pt6 "")
> > (setq en2 (entlast))
> > )
> > ;;(ssget "w" pt4 pt7))
> > (if (= chs "M")
> > (progn
> > (setvar "orthomode" 1)
> > (command "osnap" "int,midp")
> > (setq p1 (getpoint "\nSelect Intersection/Midpoint: "))
> > (command "osnap" "per")
> > (setq p2 (getpoint p1 "\nSelect Outside Face To Be Opened: "))
> > (command "osnap" "near")
> > (setq hg (getpoint p1 "\nSelect Approximate Hing Or Jamb Location:
> "))
> > (setq p3 (getpoint p1 "\nSelect Approximate Strike Or Jamb
> > Location:"))
> > ;;(setq dsz 26)
> > (setq os (/ dsz 2))
> > (setq an1 (angle p1 p3))
> > (setq p4 (polar p1 an1 os))
> > (setq an2 (angle p1 hg))
> > (setq p5 (polar p1 an2 os))
> > (setq dst (distance p1 p2))
> > (setq an3 (angle p1 p2))
> > (setq p6 (polar p5 an3 dst))
> > (setq p7 (polar p6 an1 dsz))
> > (setq dst2 (/ dst 2))
> > (setq p8 (polar p5 an3 dst2))
> > (setq p9 (polar p4 an3 dst2))
> > (setvar "osmode" osm)
> > (command "break" p4 p5 "break" p7 p6 "line" p4 p7 "")
> > (setq en1 (entlast))
> > (command "line" p5 p6 "")
> > (setq en2 (entlast))
> > ;;(ssget "f" (list p8 p9))
> > )
> > )
> > )
> > (list en1 en2)
> > ) ;end AC20.lsp
> >
> >
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report