Jump to content

i search for offset with same value and opposite direction


wrha

Recommended Posts

Thanks Kruuger,

>> why this doesn't work with RAY object?

 

Because the Ray object doesn't have an Offset method

 

Here is another version of the above, more akin to the normal offset command:

aa, thx for explanation Lee.

kruuger

Link to comment
Share on other sites

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    10

  • wrha

    6

  • alanjt

    2

  • ksavoie

    2

Top Posters In This Topic

I've averted from 'dynamic' programs - too much hassle for minimal practicality... (I've finally seen the light) - I suppose that's what you get from actually working in a DO for a period...

 

I thought that would click in :)

Drawing, like math, is an exact science for most of us.

 

... though dynamic stuff is a good learning medium.

Link to comment
Share on other sites

  • 1 year later...

Hi,

 

I'm not very proficient in LISP. I altered the code below to make 3" Conduit. Is there anyway to put the new offset lines in a new layer called CONDUIT?

 

THX,

 

Kevin

 

 

(defun c:CONDUIT3 ( / *error* of undo doc ss flg )
 (vl-load-com)

 (defun *error* ( msg )
   (and undo (vla-EndUndomark doc))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **")))
   (princ)
  )

 (if (and (ssget '((0 . "ARC,CIRCLE,ELLIPSE,*LINE")))
          (setq of 1.75))   ;*****SET RADIUS HERE******EG. 3"C RAD IS 1.75
   (progn
     (initget "Yes No")
     (setq flg (eq "Yes" (getkword "\nDelete Original? [Yes/No] <No> : ")))
     
     (setq undo
       (not
         (vla-StartUndomark
           (setq doc
             (vla-get-ActiveDocument
               (vlax-get-acad-object)
             )
           )
         )
       )
     )
     
     (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc))
       (mapcar
         (function
           (lambda ( o )
             (vl-catch-all-apply
               (function vla-offset) (list obj o)
             )
           )
         )
         (list of (- of))
       )
       (and flg (vla-delete obj))
     )
     
     (vla-delete ss)

     (setq undo (vla-EndUndoMark doc))
   )
 )
 (princ)
)

Link to comment
Share on other sites

Here is a shortened version of my original code:

 

[color=GREEN];; Double Offset to Layer  -  Lee Mac[/color]
[color=GREEN];; Offsets selected objects to both sides by the distance specified at the top of the code[/color]
[color=GREEN];; and moves the resultant objects to the layer specified.[/color]

([color=BLUE]defun[/color] c:off ( [color=BLUE]/[/color] d f l r s )
   ([color=BLUE]setq[/color] d 1.75
         l [color=MAROON]"CONDUIT"[/color]
   )
   ([color=BLUE]if[/color] ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"ARC,CIRCLE,ELLIPSE,*LINE"[/color])))
       ([color=BLUE]progn[/color]
           ([color=BLUE]initget[/color] [color=MAROON]"Yes No"[/color])
           ([color=BLUE]setq[/color] f ([color=BLUE]=[/color] [color=MAROON]"Yes"[/color] ([color=BLUE]getkword[/color] [color=MAROON]"\nDelete Original? [Yes/No] <No>: "[/color])))
           
           ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]tblsearch[/color] [color=MAROON]"LAYER"[/color] l))
               ([color=BLUE]vla-add[/color] ([color=BLUE]vla-get-layers[/color] (LM:acdoc)) l)
           )
           ([color=BLUE]vlax-for[/color] o ([color=BLUE]setq[/color] s ([color=BLUE]vla-get-activeselectionset[/color] (LM:acdoc)))
               ([color=BLUE]foreach[/color] a ([color=BLUE]list[/color] d ([color=BLUE]-[/color] d))
                   ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]vl-catch-all-error-p[/color] ([color=BLUE]setq[/color] r ([color=BLUE]vl-catch-all-apply[/color] '[color=BLUE]vlax-invoke[/color] ([color=BLUE]list[/color] o 'offset a)))))
                       ([color=BLUE]foreach[/color] b r ([color=BLUE]vla-put-layer[/color] b l))
                   )
               )
               ([color=BLUE]if[/color] f ([color=BLUE]vla-delete[/color] o))
           )
           ([color=BLUE]vla-delete[/color] s)
       )
   )
   ([color=BLUE]princ[/color])
)

[color=GREEN];; Active Document  -  Lee Mac[/color]
[color=GREEN];; Returns the VLA Active Document Object[/color]

([color=BLUE]defun[/color] LM:acdoc [color=BLUE]nil[/color]
   ([color=BLUE]eval[/color] ([color=BLUE]list[/color] '[color=BLUE]defun[/color] 'LM:acdoc '[color=BLUE]nil[/color] ([color=BLUE]vla-get-activedocument[/color] ([color=BLUE]vlax-get-acad-object[/color]))))
   (LM:acdoc)
)
([color=BLUE]vl-load-com[/color]) ([color=BLUE]princ[/color])

Link to comment
Share on other sites

  • 3 years later...

Dear sir,

 

this kranthi kumar thanks for this code

 

a small request sir please can you help on this code, offset line should be fall on current layer is it possible sir.

 

 

thanks in advance

Link to comment
Share on other sites

  • 1 year later...

This code is exactly what I was looking for. It works perfectly, thank you very much!

I would like to add some features to it, thought, but I'm really just beginning to play around with autolisp.

Could anyone fully comment the code, please, so I can go on from here?

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