Jump to content

offset with reference point and change to hidden line


Jhun Gonzalo

Recommended Posts

Hi all,

 

Please to help me to provide a multi-offset Lsp route, this route will select 1 or 2 lines and then pick the reference point other side of the line/pline or pick on mid between selected 2 lines then offset by 50mm, and it automatically change the line to hidden, :) see attached image what would be look like,

 

Many thanks to all,

multi-offset direction.jpg

Link to comment
Share on other sites

I tried a different approach :)

 

(defun c:off (/ lt off ln1 ln2 pt Objlst)
 (vl-load-com)

 (setq lt "HIDDEN") ;; <<--- Destination Linetype
 (setq off 50.) ;; <<--- Offset
 (setq objlst '())

 (if (and (setq ln1 (car (entsel "\nSelect line 1: ")))
          (setq ln2 (car (entsel "\nSelect line 2: ")))
          (vl-every
            (function
              (lambda (x)
                (vl-position x
                  '("LINE" "LWPOLYLINE" "POLYLINE"))))
            (mapcar
              (function
                (lambda (x)
                  (cdr (assoc 0 (entget x))))) (list ln1 ln2)))
          (setq pt (getpoint "\nSelect Reference Point: "))
          [color=Red][b](setq pt (trans pt 1 0)))[/b][/color]
   (foreach Obj (mapcar 'vlax-ename->vla-object (list ln1 ln2))
     (repeat 2
       (setq Objlst (append
         (vlax-safearray->list
           (vlax-variant-value
             (vla-offset Obj (setq off (* off -1.))))) Objlst)))
     (mapcar
       (function
         (lambda (x)
           (vla-put-linetype x lt))) Objlst)
     (vla-delete
       (car
         (vl-sort Objlst
           (function
             (lambda (x y)
               (< (distance pt
                    (vlax-curve-getClosestPointto x pt))
                  (distance pt
                    (vlax-curve-getClosestPointto y pt))))))))
     (setq Objlst '())))
 (princ))

Link to comment
Share on other sites

Thanks Lee,

 

Very fast creating codes:lol:

 

only one thing i have a problem on UCS, i'm trying to modify and add a TRANS code but it does'nt work, :P

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