Jump to content

Offset to different distance


Tetsuo

Recommended Posts

Hi all,

 

I'm looking for a automatisation for multi offset.

I have a polyline and i have to offset this polyline to multi distance...

For exemple : an offset to 20 than an offset to 35 and than an offset to 56 (allways offset of the source line)

 

Is it possible to create a lisp or something likethat (macro,...) with in i can enter the different value and then when I click the line and the direction the script offset the line to all the value...

 

Thx (and sorry for my bad english :-) )

Link to comment
Share on other sites

there used to be a setting that would allow you to stay in the same command for as long as you want which would probably do what you need here. However, I think the command was REPEAT which has been discontinued. As you are using an older release you could give it a try, it may still be available to you.

Link to comment
Share on other sites

Well, I'm talking about polyline sorry.

Here's a code that works fine...

But now i'd like to put a negative value ...

for exemple changing the ed var from 15 to -15 ... so that the line offset the other side...

 

(defun C:dof()
(setq ad 9)
(setq zd 10)
(setq ed 15)
(while (setq obj (car (entsel "\nSelect object:")))
(setq ps (getpoint "\nSide to offset:"))
(if ps
(progn
(command "_offset" ad obj ps "")
(command "_offset" zd obj ps "")
(command "_offset" ed obj ps "")
)
)
)
(princ)
)

 

don't know if it's possible

Link to comment
Share on other sites

You might consider using mlines. Create a multi-line style with your offset values pre-set. An mline will explode to a set of standard lines.

Link to comment
Share on other sites

Yes but I must start from a polyline...

Is it possible to convert polyligne to multiline and then a multiline to polyline...

the purpose of this manip is to convert an existing draw to multiple path for cnc tools.

 

Of as I said before is there a solution for negative value offset

Link to comment
Share on other sites

Alright,

 

here is what I do

(defun C:dof()
(setq ad 9)
(setq zd 10)
(setq ed 15)
(while (setq obj (car (entsel "\nSelect object:")))
(setq psp (getpoint "\nSide to offset positif:"))
(setq psn (getpoint "\nSide to offset negatif:"))
(if psp
(progn
(command "_offset" ad obj psp "")
(command "_offset" zd obj psp "")
(command "_offset" ed obj psn "")
)
)
)
(princ)
)

 

I defin 2 point for the offsets ... one positif (psp) and a negative one (psn). On more click but it works fine...

 

My last question : Anyone can tell me how can i put each of my offset line in a specific layer...?

Link to comment
Share on other sites

Perhaps ... ?

 

(defun c:test (/ ss e p d)
 (if (and (setq ss
                 (car (entsel "\n Select on entity [Line,Spline,Polyline] :")
                 )
          )
          (member (cdr (assoc 0 (setq e (entget ss))))
                  '("LINE" "SPLINE" "LWPOLYLINE")
          )
          (setq p (getpoint "\n Specify side offset :"))
     )
   (while
     (setq d (getdist "\n Specify offset distance :"))
      (command "_.offset" d ss p "")
   )
   (princ)
 )
 (princ)
)

 

Tharwat

Link to comment
Share on other sites

- Oh, now i understand what did you mean ^^ You can use vla-offset to offset with negative distance (but sometimes it doesn't like what you want to do ^^).

syntax : vla-offset vlaLine distance

So you can try sth like that (just for show ^^) :

 

(defun C:dof(/ lstDis obj)
(setq lstDIS '(9 10 -15))
(while (setq obj (car (entsel "\nSelect object:")))
(foreach dis lstDIS
(vla-offset (vlax-ename->vla-object obj) dis)
)
)
(princ)
)

 

-Next : in your code, you can put each *Line in a specific layer with (setvar "clayer" "your layer here") before one command

Link to comment
Share on other sites

You could do a little subroutine and build from it...

 

(defun _offsetLots (entity point offsetlist)
 (foreach offset offsetlist (command "_.offset" offset entity "_non" point ""))
)

 

call with:

(_offsetLots (entsel) (getpoint) '(1. 2. 3. 4. 5.))

Link to comment
Share on other sites

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...