Jump to content

Double Offset Lee Mac Program possible retweak to offset multiple objects?


Recommended Posts

Posted

Currently using Lee Mac's doff-lsp (Double Offset) and I find it useful. 

I wonder if it is possible to rescript so we select multiple objects instead of needing to click on every separate polyline. 

 

See example below:

In order to double offset all three polylines below I would need to doff tre separate objects.

image.thumb.png.4dcb0328d8723ba1980ccbed8821bb5c.png

 

Is it possible to get below result by rescripting the code to select multiple objects? 

image.png.c4935b06fffc247697b4feab8a889b0c.png

 

Posted

My original Double Offset application was designed to precisely emulate the prompts & options offered by the standard AutoCAD OFFSET command, however with the offset being performed to both sides rather than a selected side.

 

Here's a quickly written alternative to permit multiple object selection:

(defun c:mdoff ( / d i o s )
    (initget 6)
    (if
        (and
            (setq d (getdist "\nSpecify offset distance: "))
            (setq s
                (ssget "_:L"
                   '(
                        (0 . "ARC,CIRCLE,ELLIPSE,*LINE")
                        (-4 . "<NOT")
                            (-4 . "<AND")
                                (0 . "POLYLINE") (-4 . "&") (70 . 80)
                            (-4 . "AND>")
                        (-4 . "NOT>")
                    )
                )
            )
        )
        (repeat (setq i (sslength s))
            (setq i (1- i)
                  o (vlax-ename->vla-object (ssname s i))
            )
            (foreach x (list d (- d))
                (vl-catch-all-apply 'vlax-invoke (list o 'offset x))
            )
        )
    )
    (princ)
)
(vl-load-com) (princ)

 

  • Like 1
  • Thanks 1
Posted
18 hours ago, Lee Mac said:

My original Double Offset application was designed to precisely emulate the prompts & options offered by the standard AutoCAD OFFSET command, however with the offset being performed to both sides rather than a selected side.

 

Here's a quickly written alternative to permit multiple object selection:


(defun c:mdoff ( / d i o s )
    (initget 6)
    (if
        (and
            (setq d (getdist "\nSpecify offset distance: "))
            (setq s
                (ssget "_:L"
                   '(
                        (0 . "ARC,CIRCLE,ELLIPSE,*LINE")
                        (-4 . "<NOT")
                            (-4 . "<AND")
                                (0 . "POLYLINE") (-4 . "&") (70 . 80)
                            (-4 . "AND>")
                        (-4 . "NOT>")
                    )
                )
            )
        )
        (repeat (setq i (sslength s))
            (setq i (1- i)
                  o (vlax-ename->vla-object (ssname s i))
            )
            (foreach x (list d (- d))
                (vl-catch-all-apply 'vlax-invoke (list o 'offset x))
            )
        )
    )
    (princ)
)
(vl-load-com) (princ)

 

That works great. I wonder if it is possible to have the offsetted lines placed in layers such as your original doff-script? 

Posted
3 hours ago, bobbykimchi said:

That works great. I wonder if it is possible to have the offsetted lines placed in layers such as your original doff-script? 

 

The following will offset to the current layer:

(defun c:mdoff ( / d i l o r s )

    (setq l (getvar 'clayer))
    
    (initget 6)
    (if
        (and
            (setq d (getdist "\nSpecify offset distance: "))
            (setq s
                (ssget "_:L"
                   '(
                        (0 . "ARC,CIRCLE,ELLIPSE,*LINE")
                        (-4 . "<NOT")
                            (-4 . "<AND")
                                (0 . "POLYLINE") (-4 . "&") (70 . 80)
                            (-4 . "AND>")
                        (-4 . "NOT>")
                    )
                )
            )
        )
        (repeat (setq i (sslength s))
            (setq i (1- i)
                  o (vlax-ename->vla-object (ssname s i))
            )
            (foreach x (list d (- d))
                (if (not (vl-catch-all-error-p (setq r (vl-catch-all-apply 'vlax-invoke (list o 'offset x)))))
                    (foreach y r (vla-put-layer y l))
                )
            )
        )
    )
    (princ)
)
(vl-load-com) (princ)

 

  • Thanks 1
  • 4 years later...
Posted

Hello,

 

I just found this thread and lisp (DoubleOffsetV1-1) and installed it.   I'm searching for one where my source line would be centre of the input distance typed.  For example, when prompted I type 18" and then it would offset 9" on either side, so the the total is 18".

 

Is there a simple way to edit this one, or another known lisp out there? 

Posted

Hello ELF-153, welcome in the forum!

 

You could edit the code yourself using Notepad. After the line

(setq d (getdist.....) 

insert this:

 (setq d (* 0.5 d))

After you enter the distance, that will cut it in half before it use it.

Good luck!

Posted

You could also do a factor of offset like 1. means do 18 each side. 0.25 would do 0.25 1 side 0.75 other side. 

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