Jump to content
amb2301

lisp required to make continuous offset.

Recommended Posts

amb2301

hi friends,

(please check the attached sample file )
  i need to create a continuous boundary(black pline-output) line from the marked lots(red lined-input),

likewise i need to do for 1000+ boundaries with the offset of 0.25m from the lot property lines, lot lines are broken into many small lines,

so its taking very long time to offset each lines & joining all offset lines into 1 boundary, 
Is there any lisp to make this offset work easier...
Hope Experts here may help me.
Thanks in Advance.
 

offset sample.dwg

Edited by amb2301

Share this post


Link to post
Share on other sites
pkenewell

Try this - quickly written. Note - When you select boundaries, the entire boundary must be visible on screen. It loops until you just hit Enter to exit the program.

 

(defun c:BOFFSET (/ bp en od)
   ; Set offset distance
   (setq od 0.25)

   ; if Internal point is selected.
   (while (setq bp (getpoint "\nSelect Internal Point or <Enter> to exit: "))
      (progn
         ; Create Boundary
         (command "._-Boundary" "_non" bp "")
         ; Get new polyline created
         (setq en (entlast))
         ; Offset in toward internal point
         (command "._offset" od en bp "_non" "")
         (entdel en)
      ) ; end progn
   ) ; End If
   (princ)
) ; End defun

 

Edited by pkenewell

Share this post


Link to post
Share on other sites
amb2301

Hi pkenewell, 

           Thank you so much for looking on this thread, 

i tried with the above code, but its not happening for me, 

could you please elaborate the working steps?

 

i manually selected (as shown in screenshot) all the lines which need to offset & kept boundary visible in screen, 

but i m unable to do that.

 

image.png.11409956571c29a3aab5aeceddd3fc8c.png

Share this post


Link to post
Share on other sites
pkenewell

@amb2301 You cannot select all the boundaries at once, you just have to select an internal point for each boundary like the HATCH command, then just keep picking internal points until you have all the boundaries. As I said it will loop until you exit by pressing Enter.

 

NOTE: I don't know of a way to do exactly what you want. There is no way to determine what the inside is for each boundary is by just selecting everything at once.

Edited by pkenewell

Share this post


Link to post
Share on other sites
amb2301

@pkenewell  

 i tried selection of boundary like Hatch, but i m getting boundaries inside each lots as shown in below pic,

i need to make boundary as shown in blue tic mark, could you please try with that sample file.

sorry for troubling you

 

image.png.31f6c96becf43e484f667ae09fa2af4a.png

 

Edited by amb2301

Share this post


Link to post
Share on other sites
pkenewell

@amb2301 OK - sorry I misunderstood what you wanted. Try this. NOTE: you have to pick an Internal point, then select the OUTER boundary objects of the area. Before you press Enter after selecting the outer objects, make sure you zoom out so all objects for the selected boundary are visible on the screen. This is the best I can do i'm afraid. Perhaps someone else here can come up with something better.

 

(defun c:BOFFSET (/ bp en od ss)
   ; Set offset distance
   (setq od 0.25)

   ; if Internal point is selected.
   (while (and
            (setq bp (getpoint "\nSelect Internal Point or <Enter> to exit: "))
            (princ "\nSelect Boundary Objects: ")
            (setq ss (ssget))
          )
      (progn
         ; Create Boundary
         (command "._-Boundary" "_A" "_B" "_N" ss "" "" "_non" bp "")
         ; Get new polyline created
         (setq en (entlast))
         ; Offset in toward internal point
         (command "._offset" od en bp "_non" "")
         (entdel en)
      ) ; end progn
   ) ; End If
   (princ)
) ; End defun

 

Edited by pkenewell

Share this post


Link to post
Share on other sites
amb2301

@pkenewell  

it was a great help to me, Thank you so much for your Help, 

within a quick time, you finished it, it really great man, 

Thank you so much for being the reason i smile today :)

Share this post


Link to post
Share on other sites
amb2301
11 minutes ago, pkenewell said:

@amb2301 OK - sorry I misunderstood what you wanted. Try this. NOTE: you have to pick an Internal point, then select the OUTER boundary objects of the area. Before you press Enter after selecting the outer objects, make sure you zoom out so all objects for the selected boundary are visible on the screen. This is the best I can do i'm afraid. Perhaps someone else here can come up with something better.

 


(defun c:BOFFSET (/ bp en od ss)
   ; Set offset distance
   (setq od 0.25)

   ; if Internal point is selected.
   (while (and
            (setq bp (getpoint "\nSelect Internal Point or <Enter> to exit: "))
            (princ "\nSelect Boundary Objects: ")
            (setq ss (ssget))
          )
      (progn
         ; Create Boundary
         (command "._-Boundary" "_A" "_B" "_N" ss "" "" "_non" bp "")
         ; Get new polyline created
         (setq en (entlast))
         ; Offset in toward internal point
         (command "._offset" od en bp "_non" "")
         (entdel en)
      ) ; end progn
   ) ; End If
   (princ)
) ; End defun

 

 

 

one final ask brother, is it possible to make the layer of offset line to "Proposed Boundary" layer in the same code.

 

Share this post


Link to post
Share on other sites
pkenewell
9 minutes ago, amb2301 said:

one final ask brother, is it possible to make the layer of offset line to "Proposed Boundary" layer in the same code.

This should work for you.

(defun c:BOFFSET (/ bp en lyr od ol ss)
   ; Set offset distance
   (setq od 0.25
         lyr "Proposed Boundary"
         ol (getvar "clayer")
   )

   (if (not (tblsearch "layer" lyr))
      (command "._-layer" "_m" lyr "_s" lyr "")
      (setvar "clayer" lyr)
   )
   ; if Internal point is selected.
   (while (and
            (setq bp (getpoint "\nSelect Internal Point or <Enter> to exit: "))
            (princ "\nSelect Boundary Objects: ")
            (setq ss (ssget))
          )
      (progn
         ; Create Boundary
         (command "._-Boundary" "_A" "_B" "_N" ss "" "" "_non" bp "")
         ; Get new polyline created
         (setq en (entlast))
         ; Offset in toward internal point
         (command "._offset" od en bp "_non" "")
         (entdel en)
      ) ; end progn
   ) ; End If
   (setvar "clayer" ol)
   (princ)
) ; End defun

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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