Corner Notch?
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Corner Notch?

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Craig
Guest





Posted: Wed Jan 05, 2005 10:39 am    Post subject: Corner Notch? Reply with quote

Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1

Back to top
Kent Cooper, AIA
Guest





Posted: Wed Jan 05, 2005 9:14 pm    Post subject: Re: Corner Notch? Reply with quote

Interesting possibility.... It wouldn't be too difficult if it's always
something like what you show (some calculating X and Y coordinates by
addition and subtraction for some new points, two Change commands on the
original lines [or maybe just one with Ortho on], two new Lines). But if
you want it to cover various other possibilities, it could get much more
complicated, for example:

1) If the lines might be non-orthogonal, there'd probably need to be some
UCS involved.
2) If the lines might extend considerably beyond the notch location, Change
might move the wrong ends, so it would probably need (entmod)/(entupd) or
something.
3) If it might be used on polylines, it's more complicated to find the
right location to work around.
4) If the lines (or pline segments) might not be perpendicular to each
other, it would involve more elaborate calculations, and it would be
necessary to decide whether X should be a perpendicular dimension or a
distance along the affected lines.
5) If it might need to be asymmetrical (as Chamfer can be), it would
involve more variables in the calculations, and it would matter in what
order the lines were selected.
6) If it might need to work with arcs (circular or elliptical), I don't
even want to think about it.

But a possible approach occurs to me, not involving DRAWING the notch Lines,
that might overcome some of those problems, assuming the originals are
Lines:

a. Select the two lines and save both the pick points and the entities.
b. Fillet them to zero radius using the pick points (gets around item 2
above if they're selected at points in the parts to remain).
c. Use (inters) to find their (possibly apparent) intersection point and
save it, and compare their code 10 and 11 values to determine which end is
there and which end is the one away from the notch; save those opposite end
locations.
d. Offset each of them by X, using the pick point for the other line for
the in-which-direction prompt (gets around item 4 above, if X is a
perpendicular dimension). Or copy each of them using (polar) in the
direction that the other line goes (to get around item 4 if X is a distance
along the lines).
e. Calculate some new Fillet pick points using (polar) from the (inters)
point with directions toward the opposite ends, and distance something
larger than X for the pick points on the original lines. How to calculate
the pick points on the offset/copied lines depends on how you did item d.
above, and would likely be a two-stage (polar) operation probably using one
distance smaller than X along the original lines, and then another (polar)
from there, parallel to the original lines, with distance X in the Copy
variety, or a distance calculated from X and the relative angles in the
Offset variety.
f. Do three Fillet commands at zero radius (gets around the need to
calculate points for drawing Lines, so eliminates item 1 above).

The Offset (or Copy) and Fillet approach also eliminates the need for any
Layer controls (at least assuming the two original lines are on the same
Layer).

And it wouldn't be too severely more complicated to make an asymmetrical
notch (X and Y values) this way.

Just a start....
--
Kent Cooper, AIA


Quote:
"Craig" wrote...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.
--
Craig
Back to top
Dann
Guest





Posted: Wed Jan 05, 2005 9:24 pm    Post subject: Re: Corner Notch? Reply with quote

The following should work IF the 2 entities to add the notch to are both
lines and is as simple as
your example Drawing suggests.....See Kent Coopers response.
Also you may want to add some error checking.....This is a start.

(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2
)
(vl-load-com)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(setq xdim (getreal "Enter Dimension For X: "))
(setq co1 (objsel "Select First Line: "))
(setq co2 (objsel "Select Second Line: "))
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq int (vlax-invoke co1 'IntersectWith co2 acExtendBoth))
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine mspc (vlax-3d-point pt4) (vlax-3d-point pt5))
)
(setq nlin2
(vla-AddLine mspc (vlax-3d-point pt3) (vlax-3d-point pt5))
)
)
(princ "Object Must Be A Line: ")
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
;The following gets and returns a selected object in activex format
;******************************************************************

(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)


"Craig" <cdp@iinet.net.au> wrote in message news:41db7dda_1@newsprd01...
Quote:
oops forgot the image
might make it easier to understand

"Craig" <cdp@iinet.net.au> wrote in message news:41db7d94_3@newsprd01...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1






Back to top
David Kozina
Guest





Posted: Wed Jan 05, 2005 9:36 pm    Post subject: Re: Corner Notch? Reply with quote

One idea:

Create a unit square wipeout, with bottom left corner at origin, then extend
the TOP and RIGHT sides, say, 1/16th unit or 1/32nd unit more. (So it's
really 1.0625 units square.) Put it on layer 0, but give it a PlotStyle or
Color that will be Invisible when plotted.
Then draw a HEAVYWEIGHTPOLYLINE (not a LWPOLY) from (0,1,0) to (0,0,0) to
(1,0,0). (IOW on the left and bottom sides. Note that the pline IS one
unit exactly.) Layer 0, Color ByBlock, LType ByBlock, LWeight ByBlock,
PlotStyle ByBlock. Create a block from that geometry, insertion point at
(0,0,0).

Insert and Scale to suit.

Cake. Wish I'd thought of it. :)

Best regards,
David Kozina


"Craig" <cdp@iinet.net.au> wrote in message news:41db7dda_1@newsprd01...
Quote:
oops forgot the image
might make it easier to understand

"Craig" <cdp@iinet.net.au> wrote in message news:41db7d94_3@newsprd01...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1




Back to top
David Kozina
Guest





Posted: Wed Jan 05, 2005 9:38 pm    Post subject: Re: Corner Notch? Reply with quote

oops, see below...

"David Kozina" <djkozina@t-3.cc> wrote in message
news:41dc1793$1_1@newsprd01...
Quote:
One idea:

Create a unit square wipeout, with bottom left corner at origin, then
extend the TOP and RIGHT sides, say, 1/16th unit or 1/32nd unit more. (So
it's really 1.0625 units square.)
^ or 1.03125 units square, of course
Back to top
David Kozina
Guest





Posted: Wed Jan 05, 2005 9:41 pm    Post subject: Re: Corner Notch? Reply with quote

Note that variations of that method could work for re-sizable Fillets and
Chamfers, too, btw.

hth,
David Kozina
Back to top
David Kozina
Guest





Posted: Thu Jan 06, 2005 8:22 pm    Post subject: Re: Corner Notch? Reply with quote

Craig,

After thinking a bit more about what I wrote below, I realized (*doh!*) that
the Insertion Point would be more optimally located at 1,1,0, rather than
the origin. (Or, move all the described geometry one unit down and one unit
to the left, and keep the block insertion point at 0,0,0). This would allow
you to insert the "notch block" at the original corner itself, and later
allow the notch to be easily re-scaled without having to move it again.
Hope this makes sense to you.

Best regards,
David Kozina


"David Kozina" <djkozina@t-3.cc> wrote in message
news:41dc1793$1_1@newsprd01...
Quote:
Create a unit square wipeout, with bottom left corner at origin, then
extend the TOP and RIGHT sides, say, 1/16th unit or 1/32nd unit more. (So
it's really 1.0625 units square.) Put it on layer 0, but give it a
PlotStyle or Color that will be Invisible when plotted.
Then draw a HEAVYWEIGHTPOLYLINE (not a LWPOLY) from (0,1,0) to (0,0,0) to
(1,0,0). (IOW on the left and bottom sides. Note that the pline IS one
unit exactly.) Layer 0, Color ByBlock, LType ByBlock, LWeight ByBlock,
PlotStyle ByBlock. Create a block from that geometry, insertion point at
(0,0,0).

Insert and Scale to suit.


"Craig" <cdp@iinet.net.au> wrote in message news:41db7dda_1@newsprd01...
oops forgot the image
might make it easier to understand

"Craig" <cdp@iinet.net.au> wrote in message news:41db7d94_3@newsprd01...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1






Back to top
Kent Cooper, AIA
Guest





Posted: Thu Jan 06, 2005 10:14 pm    Post subject: Re: Corner Notch? Reply with quote

The wipeout approach is kind of interesting as an outside-the-box idea, but
I see several practical problems with it:

1) Unless the notch is always in an upper right corner, you have to put the
thing in with rotation. But unless the original lines extend beyond the
corner (unlike the original illustration), there's nothing to osnap to for
the rotation, so if it isn't some easy angle (like an orthogonal or
polar-increment one), you'd have to put it in first, and then rotate it. It
might be better to set it up with the geometry rotated 180 degrees around
its insertion point, so the insert rotation angle can go along one of the
lines, and you'd have something to osnap to.
2) It wouldn't work if you ever need to notch a non-right-angle corner
(unless AutoCAD comes up with a skew angle for block insertions, or
something -- has that appeared in A2005?).
3) If the original lines extend beyond the corner to be notched, the
wipeout won't take care of those extended parts, so the operation wouldn't
really be analogous to filleting.
4) You couldn't dimension the edges that are affected by the notch with
return-to-select picking, because that would give you the dimension to the
apparent-intersection corner (or worse, if the lines extend beyond). Even
doing that for the overall dimension (if the lines don't extend beyond), the
dimension's extension line at the notched corner wouldn't go in to the right
place, and even if you did it explicitly to the right location, I expect
part of the extension line would be wiped out. I haven't tried Qdim on this
kind of thing, but I wonder whether it would handle it the way you'd want it
to.
5) Admittedly nothing suggested so far would deal with notching a polyline
corner, but I could easily see doing it with lines and then converting the
outline into a polyline for a direct area or perimeter reading (for a
building footprint, or site boundary, or machine part, or whatever). That
wouldn't work with the wipeout-variety notch. Similarly, if you want to
convert the outline into, say, a region for a center-of-gravity calculation,
or extrude it into a 3D solid.
6) You couldn't offset the notch edges (such as in a building plan, where
the notched outline might represent the building perimeter, and you might
offset that to show a footing below, or the inside face of the walls). Nor
could you copy them, nor use stretch to change the proportions of the notch,
nor probably a bunch of other things.
7) The wipeout could hide things you really want to see, in addition to the
ends of those lines (such as an underground utility line skirting the corner
of a building, or hidden lines representing a roof above that extends out to
the virtual corner, or the tree that you plant in the notch).

But I do appreciate thinking up the less-obvious ways of doing things,
because sometimes that really does result in a better solution to something.
--
Kent Cooper, AIA


"David Kozina" wrote...
Quote:
Craig,

After thinking a bit more about what I wrote below, I realized (*doh!*)
that the Insertion Point would be more optimally located at 1,1,0, rather
than the origin. (Or, move all the described geometry one unit down and
one unit to the left, and keep the block insertion point at 0,0,0). This
would allow you to insert the "notch block" at the original corner itself,
and later allow the notch to be easily re-scaled without having to move it
again. Hope this makes sense to you.

Best regards,
David Kozina
Back to top
Craig
Guest





Posted: Fri Jan 07, 2005 4:26 am    Post subject: Re: Corner Notch? Reply with quote

thanks for the responses everyone
it gives me some things to think about

"Craig" <cdp@iinet.net.au> wrote in message news:41db7d94_3@newsprd01...
Quote:
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1

Back to top
Craig
Guest





Posted: Tue Jan 11, 2005 7:46 am    Post subject: Re: Corner Notch? Reply with quote

Dann

ive tried this and it works great, how would i get it to repeat using the
same dimension until i quit the command
generally i would want to use it on all 4 corners with the same dimension
thanks for the help so far

Craig

"Dann" <NoneSpecified> wrote in message news:41dc14db$1_3@newsprd01...
Quote:
The following should work IF the 2 entities to add the notch to are both
lines and is as simple as
your example Drawing suggests.....See Kent Coopers response.
Also you may want to add some error checking.....This is a start.

(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2
)
(vl-load-com)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(setq xdim (getreal "Enter Dimension For X: "))
(setq co1 (objsel "Select First Line: "))
(setq co2 (objsel "Select Second Line: "))
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq int (vlax-invoke co1 'IntersectWith co2 acExtendBoth))
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine mspc (vlax-3d-point pt4) (vlax-3d-point pt5))
)
(setq nlin2
(vla-AddLine mspc (vlax-3d-point pt3) (vlax-3d-point pt5))
)
)
(princ "Object Must Be A Line: ")
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
;The following gets and returns a selected object in activex format
;******************************************************************

(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select
Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)


"Craig" <cdp@iinet.net.au> wrote in message news:41db7dda_1@newsprd01...
oops forgot the image
might make it easier to understand

"Craig" <cdp@iinet.net.au> wrote in message news:41db7d94_3@newsprd01...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1






Back to top
Dann
Guest





Posted: Tue Jan 11, 2005 7:21 pm    Post subject: Re: Corner Notch? Reply with quote

(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2 default)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(if (= default nil)
(setq default 0.250)
)
(setq co1 1)
(while (/= co1 nil)
(setq xdim (getreal
(strcat "Enter Dimension For X <"
(rtos default)
">: "
)
)
)
(if (= xdim nil)
(setq xdim default)
)
(setq default xdim)
(setq co1 (objsel "Select First Line: "))
(if (/= co1 nil)
(progn
(setq co2 (objsel "Select Second Line: "))
(if (/= co2 nil)
(progn
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq
int (vlax-invoke
co1
'IntersectWith
co2
acExtendBoth
)
)
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine
mspc
(vlax-3d-point pt1)
(vlax-3d-point pt2)
)
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine
mspc
(vlax-3d-point pt1)
(vlax-3d-point pt2)
)
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine
mspc
(vlax-3d-point pt4)
(vlax-3d-point pt5)
)
)
(setq nlin2
(vla-AddLine
mspc
(vlax-3d-point pt3)
(vlax-3d-point pt5)
)
)
)
(princ "***Object Must Be A Line***")
)
)
)
)
)
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)






"Craig" <cdp@iinet.net.au> wrote in message news:41e33e1f$1_3@newsprd01...
Quote:
Dann

ive tried this and it works great, how would i get it to repeat using the
same dimension until i quit the command
generally i would want to use it on all 4 corners with the same dimension
thanks for the help so far

Craig

"Dann" <NoneSpecified> wrote in message news:41dc14db$1_3@newsprd01...
The following should work IF the 2 entities to add the notch to are both
lines and is as simple as
your example Drawing suggests.....See Kent Coopers response.
Also you may want to add some error checking.....This is a start.

(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2
)
(vl-load-com)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(setq xdim (getreal "Enter Dimension For X: "))
(setq co1 (objsel "Select First Line: "))
(setq co2 (objsel "Select Second Line: "))
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq int (vlax-invoke co1 'IntersectWith co2 acExtendBoth))
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine mspc (vlax-3d-point pt4) (vlax-3d-point pt5))
)
(setq nlin2
(vla-AddLine mspc (vlax-3d-point pt3) (vlax-3d-point pt5))
)
)
(princ "Object Must Be A Line: ")
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
;The following gets and returns a selected object in activex format
;******************************************************************

(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select
Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)


"Craig" <cdp@iinet.net.au> wrote in message news:41db7dda_1@newsprd01...
oops forgot the image
might make it easier to understand

"Craig" <cdp@iinet.net.au> wrote in message
news:41db7d94_3@newsprd01...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1








Back to top
Craig
Guest





Posted: Wed Jan 12, 2005 4:30 am    Post subject: Re: Corner Notch? Reply with quote

I can't thank you enough Dann
this has made my life so much easier

Craig

"Dann" <NoneSpecified> wrote in message news:41e3e0cb$1_1@newsprd01...
Quote:
(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2 default)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(if (= default nil)
(setq default 0.250)
)
(setq co1 1)
(while (/= co1 nil)
(setq xdim (getreal
(strcat "Enter Dimension For X <"
(rtos default)
">: "
)
)
)
(if (= xdim nil)
(setq xdim default)
)
(setq default xdim)
(setq co1 (objsel "Select First Line: "))
(if (/= co1 nil)
(progn
(setq co2 (objsel "Select Second Line: "))
(if (/= co2 nil)
(progn
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq
int (vlax-invoke
co1
'IntersectWith
co2
acExtendBoth
)
)
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine
mspc
(vlax-3d-point pt1)
(vlax-3d-point pt2)
)
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine
mspc
(vlax-3d-point pt1)
(vlax-3d-point pt2)
)
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine
mspc
(vlax-3d-point pt4)
(vlax-3d-point pt5)
)
)
(setq nlin2
(vla-AddLine
mspc
(vlax-3d-point pt3)
(vlax-3d-point pt5)
)
)
)
(princ "***Object Must Be A Line***")
)
)
)
)
)
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select
Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)






"Craig" <cdp@iinet.net.au> wrote in message news:41e33e1f$1_3@newsprd01...
Dann

ive tried this and it works great, how would i get it to repeat using
the
same dimension until i quit the command
generally i would want to use it on all 4 corners with the same
dimension
thanks for the help so far

Craig

"Dann" <NoneSpecified> wrote in message news:41dc14db$1_3@newsprd01...
The following should work IF the 2 entities to add the notch to are
both
lines and is as simple as
your example Drawing suggests.....See Kent Coopers response.
Also you may want to add some error checking.....This is a start.

(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2
)
(vl-load-com)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(setq xdim (getreal "Enter Dimension For X: "))
(setq co1 (objsel "Select First Line: "))
(setq co2 (objsel "Select Second Line: "))
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq int (vlax-invoke co1 'IntersectWith co2 acExtendBoth))
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine mspc (vlax-3d-point pt4) (vlax-3d-point pt5))
)
(setq nlin2
(vla-AddLine mspc (vlax-3d-point pt3) (vlax-3d-point pt5))
)
)
(princ "Object Must Be A Line: ")
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
;The following gets and returns a selected object in activex
format

;******************************************************************

(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select
Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)


"Craig" <cdp@iinet.net.au> wrote in message
news:41db7dda_1@newsprd01...
oops forgot the image
might make it easier to understand

"Craig" <cdp@iinet.net.au> wrote in message
news:41db7d94_3@newsprd01...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1










Back to top
Dann
Guest





Posted: Wed Jan 12, 2005 5:34 pm    Post subject: Re: Corner Notch? Reply with quote

Your welcome. ;)



"Craig" <cdp@iinet.net.au> wrote in message news:41e4619c_1@newsprd01...
Quote:
I can't thank you enough Dann
this has made my life so much easier

Craig

"Dann" <NoneSpecified> wrote in message news:41e3e0cb$1_1@newsprd01...
(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2 default)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(if (= default nil)
(setq default 0.250)
)
(setq co1 1)
(while (/= co1 nil)
(setq xdim (getreal
(strcat "Enter Dimension For X <"
(rtos default)
">: "
)
)
)
(if (= xdim nil)
(setq xdim default)
)
(setq default xdim)
(setq co1 (objsel "Select First Line: "))
(if (/= co1 nil)
(progn
(setq co2 (objsel "Select Second Line: "))
(if (/= co2 nil)
(progn
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq
int (vlax-invoke
co1
'IntersectWith
co2
acExtendBoth
)
)
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine
mspc
(vlax-3d-point pt1)
(vlax-3d-point pt2)
)
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine
mspc
(vlax-3d-point pt1)
(vlax-3d-point pt2)
)
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine
mspc
(vlax-3d-point pt4)
(vlax-3d-point pt5)
)
)
(setq nlin2
(vla-AddLine
mspc
(vlax-3d-point pt3)
(vlax-3d-point pt5)
)
)
)
(princ "***Object Must Be A Line***")
)
)
)
)
)
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select
Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)






"Craig" <cdp@iinet.net.au> wrote in message
news:41e33e1f$1_3@newsprd01...
Dann

ive tried this and it works great, how would i get it to repeat using
the
same dimension until i quit the command
generally i would want to use it on all 4 corners with the same
dimension
thanks for the help so far

Craig

"Dann" <NoneSpecified> wrote in message news:41dc14db$1_3@newsprd01...
The following should work IF the 2 entities to add the notch to are
both
lines and is as simple as
your example Drawing suggests.....See Kent Coopers response.
Also you may want to add some error checking.....This is a start.

(defun C:cnotch (/ mspc xdim pt1 pt2 pt3 pt4 pt5 ang
ang3 ang4 int co1 co2 nlin1 nlin2 nco1 nco2
)
(vl-load-com)
(command "undo" "mark")
(setq mspc (vla-get-ModelSpace
(vla-get-activeDocument
(vlax-get-object "Autocad.application")
)
)
)
(setq xdim (getreal "Enter Dimension For X: "))
(setq co1 (objsel "Select First Line: "))
(setq co2 (objsel "Select Second Line: "))
(if (and (= (vla-get-ObjectName co1) "AcDbLine")
(= (vla-get-ObjectName co2) "AcDbLine")
)
(progn
(setq int (vlax-invoke co1 'IntersectWith co2 acExtendBoth))
(reline co1 int xdim)
(setq pt3 pt1)
(setq ang3 ang)
(vlax-invoke co1 'Erase)
(setq nco1
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(reline co2 int xdim)
(setq pt4 pt1)
(setq ang4 ang)
(vlax-invoke co2 'Erase)
(setq nco2
(vla-AddLine mspc (vlax-3d-point pt1) (vlax-3d-point pt2))
)
(setq pt5 (polar pt4 ang3 xdim))
(setq nlin1
(vla-AddLine mspc (vlax-3d-point pt4) (vlax-3d-point pt5))
)
(setq nlin2
(vla-AddLine mspc (vlax-3d-point pt3) (vlax-3d-point pt5))
)
)
(princ "Object Must Be A Line: ")
)
(princ)
)
(defun reline (lin int xdim / stpt endpt)
(setq stpt (vlax-get lin 'StartPoint))
(setq endpt (vlax-get lin 'EndPoint))
(if (> (distance int stpt) (distance int endpt))
(progn
(setq ang (angle endpt stpt))
(setq pt1 (polar int ang xdim))
(setq pt2 stpt)
)
(progn
(setq ang (angle stpt endpt))
(setq pt1 (polar int ang xdim))
(setq pt2 endpt)
)
)
)
;The following gets and returns a selected object in activex
format

;******************************************************************

(defun objsel ($prompt / ent obj) ;usage = (setq obj(objsel "Select
Object:
"))
(setq ent (car (entsel $prompt)))
(if (/= ent nil)
(setq obj (vlax-ename->vla-object ent))
(princ "No Object Selected")
)
obj ;returns result for use in calling program
)


"Craig" <cdp@iinet.net.au> wrote in message
news:41db7dda_1@newsprd01...
oops forgot the image
might make it easier to understand

"Craig" <cdp@iinet.net.au> wrote in message
news:41db7d94_3@newsprd01...
Just wondering if it possible to achieve this with lisp?
I would like to set the distance 'x' and pick the lines similar to
setting
the radius and pick the lines for a fillet.

--
Craig

IV9 Series SP2
Win XP Pro SP1












Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB