Delete original and linked objects after offset.

Delete original and linked objects after offset.

Anonymous
Not applicable
1,721 Views
12 Replies
Message 1 of 13

Delete original and linked objects after offset.

Anonymous
Not applicable
I modified Lisp to delete the original object after offset.
As shown in the figure, we want to delete the linked object as well.

I want to know how to solve it.

 

 

 

MO.jpg

 

 

 

 

 

 
 
0 Likes
1,722 Views
12 Replies
Replies (12)
Message 2 of 13

devitg
Advisor
Advisor

Please upload your sample dwg 

0 Likes
Message 3 of 13

Kent1Cooper
Consultant
Consultant

Please explain in more detail.  Specifically, what part of the image is "the linked object"?

 

[Also, if you have a new-enough version of AutoCAD, you don't need that MO.lsp routine -- the basic Offset command now has an option to erase the source object.]

Kent Cooper, AIA
0 Likes
Message 4 of 13

Anonymous
Not applicable

I reattach the sample picture and the dwg file.

 

Sequence of the work.

1. Offset 7 mm by selecting a 30 mm long horizontal line.

2. The color changes to red for offset segments.

3.The length is reduced by 7 mm on the left and right vertical lines connected to the horizon.

4. The first 30mm horizontal line selected is deleted.

 

Sample dwg.jpg

 

 

 

 

0 Likes
Message 5 of 13

doaiena
Collaborator
Collaborator

You can use the "Stretch" command + ortho. That will give you the desired results. At the end just delete the horizontal line by hand.

0 Likes
Message 6 of 13

devitg
Advisor
Advisor

Please pardon me , I do not understand the task to do. 

Feel free to contact me at my e-mail  devitg@gmail.com 

I'm from Córdoba, Argentina 

0 Likes
Message 7 of 13

Anonymous
Not applicable
I'm working on that too. There are a lot of repetitive tasks, so I'm going to use Lisp.
0 Likes
Message 8 of 13

Anonymous
Not applicable

I sent you a mail.

0 Likes
Message 9 of 13

Kent1Cooper
Consultant
Consultant

STRETCH will do the upper part as suggested [though the idea of automating that into a routine raises other questions], but is the bottom of the image just extraneous, or is it part of what you want a routine to do?  Is the left white part already 3 Lines so that [done manually] STRETCH would handle it?

Kent Cooper, AIA
0 Likes
Message 10 of 13

Anonymous
Not applicable

Kent Cooper

 

I know that I can use the STRETCH command. I want to work a little bit faster using Lisp.
 

 

 

0 Likes
Message 11 of 13

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:
I know that I can use the STRETCH command. I want to work a little bit faster using Lisp.

 

It would help if you would answer my questions in Messages 3 and 9, as well as these:

 

What would you want to be the steps a User would take?  It seems to me that if not limited to a very narrow range of specific circumstances, any routine might be no simpler in operation  than just using STRETCH.

 

What would the User select, and how would they select it or them?  And how would they specify how far to Offset?  [Obviously, from your examples, it would not  always be the same distance, so that can't be built in.]  Would the direction  of Offsetting always be the same [upward in your examples], or would they need to specify which way?  Would it always be up-vs.-down, or sometimes left-vs.-right, or sometimes at non-orthogonal angles?  Would the pieces involved always be Lines  specifically, or might there be other kinds of objects, or might they be just parts of a single  object [typically a Polyline]?  If they're separate pieces, would you want the routine to find  the ones that connect at the ends of one you would select, or would they be part of the User's selection?  Would there always be only one  object touching it at each end, or might there be more than one, and if so would only one need to be altered, or all of them?  Might there sometimes be no  object touching at one of the ends?  Would it always be only one  object [or one  Polyline segment] that Offsets, or might there sometimes be more than one that should be Offset/Moved together?  Your examples include Dimensions -- is that just for illustration, or would Dimension objects be there and should they also be adjusted accordingly?

 

If you connect the pieces into a Polyline in which you want to do the equivalent of STRETCHing one line segment, and have adjacent segments' adjoining ends follow along, no command or routine is required.  You can simply select the Polyline and grab the midpoint grip of that segment, and take it where you want it -- very simple if in an orthogonal direction, when you can just aim the cursor in the direction you want and type in the distance.  But that's not going to have the effect you seem to want if the segment is an arc.

Kent Cooper, AIA
0 Likes
Message 12 of 13

hak_vz
Advisor
Advisor

One of solution to your problem is using command STRETCH, and it has been extensively elaborated.

 

The other option is to use command DIMDISASSOCIATE

That way your dimension entities won't change or vanish. Then you can modify your starting object.

If you have to use EXPLODE when applicable, and reconnect modified start object at the end.

To preserve from accidental removing dimension associations where is not needed you may place them to locked layer. Some dimension object can be later re-associated  using command DIMREASSOCIATE.

Writing a lisp that would do that is not an easy task to do, but you may try.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 13 of 13

Sea-Haven
Mentor
Mentor

My $0.05 enter shrink/extend amount and do just that to a line by picking near end, move bottom or side etc same amount change  color , do new dim 7 .

 

Bottom is complety different method as lines must stretch to use that term.

 

;shorten paralell lines and move bottom line
; By AlanH Dec 2019
;https://forums.autodesk.com/t5/forums/replypage/board-id/130/message-id/392823
(defun short (pent dist / ) (setq pt3 (cadr pent)) (setq obj (vlax-ename->vla-object (car pent ))) (if (= (vla-get-objectname obj) "AcDbLine") (progn (setq pt2 (vlax-get Obj 'EndPoint)) (setq pt1 (vlax-get Obj 'StartPoint)) (setq d1 (distance pt1 pt3)) (setq d2 (distance pt2 pt3)) (if (> d1 d2) (progn (setq temp pt1) (setq pt1 pt2) (setq pt2 temp) ) ) (setq ang (angle pt1 pt2)) (setq pt1 (polar pt1 ang dist)) (vlax-put Obj 'EndPoint pt2) (vlax-put Obj 'StartPoint pt1) (if (= pt4 nil)(setq pt4 pt1)) ) ) ) (defun c:test ( / oldsnap ent1 ent2 ent3 off pt1 pt2 pt3 pt4 pt5)
(setq oldsnap (getvar 'osmode)) (setq ent1 (entsel "Pick line 1 near end")) (setq ent2 (entsel "Pick line 2 near mid")) (setq ent3 (entsel "Pick line 3 near end")) (setq off (getreal "enter offset + to shrink -ve longer")) (short ent1 off) (short ent3 off) (setq pt5 (polar pt1 ang off)) (setvar 'osmode 0) (command "move" ent2 "" pt1 pt5) (command "chprop" ent2 "" "c" 1 "")
(setvar 'osmode oldsnap) (princ) ) (c:test)

 

0 Likes