Jump to content

adding default value and making layer according to current


Recommended Posts

Posted

Hello ....

 

Here is a link to Lee which is really very nice , and would like to add a few things to it if that possible .

 

the link >> Doff

 

1- making the the first value I enter as a default number with acceptance [yes,no]

2- making the offset objects according to current layer .

 

Hope it is possible .

 

Thanks

Posted

For default values on prompters please check this previous discussion.

 

To move the result of a draw action to current layer you may try:

(command "_CHPROP" (entlast) "" "_LA" (getvar "CLAYER") "")

 

Or:

(setq OldLayer (getvar "CLAYER"))   ;store current layer
(setvar "CLAYER" MyDrawLayer)       ;switch to desired layer
; do draw actions here...
(setvar "CLAYER" OldLayer)          ;restore previous layer

 

Regards,

Mircea

Posted

Thanks Mircea for your idea , :)

 

Thanks Lee , that works very nice . (although that I hoped it uses multiple selection set ) :)

 

Thank you so much .

Posted

Double-Offset:

 

(defun c:dOff ( / doc sel )
   (if
       (and
           (ssget "_:L" '((0 . "ARC,CIRCLE,ELLIPSE,*LINE")))
           (setq *of (cond ((getdist (strcat "\nSpecify Offset" (if *of (strcat " <" (rtos *of) ">: ") ": ")))) (*of)))
       )
       (progn
           (vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
           (vlax-for obj (setq sel (vla-get-activeselectionset doc))
               (foreach off (list *of (- *of)) (vl-catch-all-apply 'vla-offset (list obj off)))
           )
           (vla-delete sel)
           (vla-endundomark doc)
       )
   )
   (princ)
)
(vl-load-com) (princ)

 

Double-Offset to Current Layer:

 

(defun c:dOffc ( / doc lay sel )
   (if
       (and
           (ssget "_:L" '((0 . "ARC,CIRCLE,ELLIPSE,*LINE")))
           (setq *of (cond ((getdist (strcat "\nSpecify Offset" (if *of (strcat " <" (rtos *of) ">: ") ": ")))) (*of)))
       )
       (progn
           (setq lay (getvar 'CLAYER))
           (vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
           (vlax-for obj (setq sel (vla-get-activeselectionset doc))
               (foreach off (list *of (- *of))
                   (if (not (vl-catch-all-error-p (setq err (vl-catch-all-apply 'vlax-invoke (list obj 'offset off)))))
                       (foreach obj err (vla-put-layer obj lay))
                   )
               )
           )
           (vla-delete sel)
           (vla-endundomark doc)
       )
   )
   (princ)
)
(vl-load-com) (princ)

Posted

That is great Lee .

 

Thank you so much . :D

 

Michaels

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