Jump to content

Recommended Posts

Posted

hello .

 

I have a riser duct as shown in the drawing , and I want to select the YELLOW lines and the offset should go one on the right and one on the left side to become the same as the RED lines .

 

Hope this possible with lisp :D

example.dwg

Posted
hello .

 

I have a riser duct as shown in the drawing , and I want to select the YELLOW lines and the offset should go one on the right and one on the left side to become the same as the RED lines .

 

Hope this possible with lisp :D

 

"OFFSET OBJECTS to..."

 

Requested too many times that Autodesk ought to incldue a command on the next version called ToOffsetThisAndThatToThereOrThere :D

command alia: TOTATATOT

 

Anyhoo. issues i encounter writing a code for TOTATATOT function.

 

Type of objects

Direction of objects

Point value for Side to offset or to supress prompt for "side to offset"

Layer/Color/Ltype for the newly created entity

Make use of TRUE offset or make new objects

 

Just my 2 cents ;)

Posted

The link that given by Remark is very nice code by Lee , but it does not work in my case . :cry:

 

pbe , I did not understand your idea , so would you please take a look at the drawing to see what I am refereeing to ?

 

Thank you all

Posted
The link that given by Remark is very nice code by Lee , but it does not work in my case . :cry:

 

pbe , I did not understand your idea , so would you please take a look at the drawing to see what I am refereeing to ?

 

Thank you all

 

I'm expressing an opinion Michaels, pay no attention to it :lol:

 

I had look/see at your drawing. and while i'm pondering on the approach on your request those questions above kept on popping in my head.

 

Tell me, how would you go about doing it? keeping in mind the issues i posted. How would you answer it?

Posted
"OFFSET OBJECTS to..."

 

 

Type of objects

Direction of objects

Point value for Side to offset or to supress prompt for "side to offset"

Layer/Color/Ltype for the newly created entity

 

 

1- select only lines (2 numbers )

2- the line which is on the left its offset line should go left and the one on the right should go on the right .

3- ( if you mean the distance of the offset ) it is always 50.0

4- Layer should follow the original Layer ( of lines ).

 

Did I answer them correctly ? :D

 

Thanks a lot for your interests pBe.

Posted

1. Check

2. Check

3. Check

4. Check

 

Okay that narrows it down.

 

Now all you need to do now is wait ... somebody will come along and write a code or point you in the right diretion.

 

Patience Michaels :)

Posted

Whoa ... i'm surpirsed no one else wrote a code for you.. i'm on vacation (from cad at least). i guess what i can do is give a suggestion.

(if and (setq ss (ssget "_:L"))(= (setq i (sslength ss)) 2))

Get midpoint of both lines

Midpoint of two points as reference to test for "side to offset", the point will be oposite to where the new lines will be. easy huh?

 

As soon as i can get my hands on CAD i'll write one for you, but i dont see that happening anytime soon. :lol:

 

but i'm sure someone here will get it to later.

 

again be patient Michaels

  • 2 weeks later...
Posted

Here's a quick one

 

(defun c:o2  (/ _dxf ss pts rf pt1 pt2)
     (defun _dxf (e n) (cdr (assoc n (entget e))))
     (defun _mid  (p1 p2)
           (mapcar (function (lambda (a b) (/ (+ a b) 2.))) p1 p2))
     (while
           (and (princ "\nSelect 2 Lines to offset")
  (setq ss (ssget "_:L" '((0 . "LINE")))) (= (setq i (sslength ss)) 2))
                (setq pts (list (_dxf (setq 1st (ssname ss 0)) 10)
                                (_dxf 1st 11)
                                (_dxf (setq 2nd (ssname ss 1)) 10)
                                (_dxf 2nd 11)))
                (setq rf (_mid (setq pt1 (_mid (car pts) (cadr pts)))
                               (setq pt2 (_mid (caddr pts)
                                               (cadddr pts)))))
                (command "_offset"  50.0
                      (ssname ss 0) "_non"
                      (polar rf
                             (angle rf pt1)
                             (+ (distance rf pt1) 50.0))
                      "")
                (command "_offset"
                      50.0 (ssname ss 1) "_non"
                      (polar rf
                             (angle rf pt2)
                             (+ (distance rf pt2) 50.0))
                      "")
                )
     (princ)
     )

 

I'm a bit surprised really no one else wrote a code for this :unsure: just got back from vacation.

Anyhoo.. try it out Michaels and tell me what you think (that is if you still need a lisp routine for your request) :)

Posted
I'm a bit surprised really no one else wrote a code for this :unsure:

 

We're not here just to write code for people.

Posted
We're not here just to write code for people.

 

Well that explains it... :lol:

 

Curioulsy, nobody else jumped on this particular request even though i'm egging others to do so... like the way other forum members do in the past.

 

...somebody will come along and write a code or point you in the right diretion....
...but i'm sure someone here will get it to later....

 

Anyhoo... i wasnt implying anything really. :) just horsing around.

 

Cheers LM

  • 2 weeks later...
Posted

Michaels,

 

Did I just wasted my time writing the code?

 

And then there was me thinking you were neglected.

 

:glare:

Posted

Pbe easier way message "pick left hand side of line near end" then no matter what angle line is drawn at you imply which is left and right, use start,end,pick pt compare and swap start,end if required. After a few mistakes you get the hang of picking upside down for right=left.

Posted
Pbe easier way message "pick left hand side of line near end" then no matter what angle line is drawn at you imply which is left and right, use start,end,pick pt compare and swap start,end if required. After a few mistakes you get the hang of picking upside down for right=left.

 

I had thought of that too, i was trying to avoid the overhead of swapping the points in the event the lines selected are not created with the same direction hence i used midpoint as the basis

 

But I will take that into consideration that is if we ever get to hear anything fom the OP :lol:

 

Cheers Bigal

Posted
Michaels,

 

Did I just wasted my time writing the code?

 

And then there was me thinking you were neglected.

 

:glare:

 

Hi pBe .

 

I am sorry for this late reply to your nice work , it is very helpful .

 

Thank you so much , I will add it immediately to my adddoc.lsp to be a part of my daily command . :)

 

Sorry again .

Posted
Hi pBe .

 

I am sorry for this late reply to your nice work

 

No need to apologise Michaels, just wondering if the code helped you with your problem is all.

 

Cheers

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...