Jump to content

Recommended Posts

Posted

I have a lisp that draw some things, after i select a point - like a reference point. If i select the point in model, those things will be drawn in model, and if i switch to paper, will be drawn in paper - like the point was selected in paper. I want to use my lisp both ways, if i work in model or in paper, but those things that should be made by lisp to be drawn always in model or paper - how to do it?

Posted

Use CTAB variable to check or set the current tab:

(getvar "CTAB")
(setvar "CTAB" "Model")

The LAYOUTLIST function will give you the list of layout tabs available in drawing.

(layoutlist)

Posted

(defun aspace nil
 (vlax-get
   (setq *acdoc*
     (cond
       ( *acdoc* )
       ( (vla-get-activedocument
           (vlax-get-acad-object)
         )
       )
     )
   )
   (cond
     ( (eq AcModelSpace (vlax-get *acdoc* 'ActiveSpace))
       'ModelSpace
     )
     ( 'PaperSpace )
   )
 )
)

Example:

(vlax-invoke (aspace) 'addline '(0. 0. 0.) '(1. 1. 0.))

Posted

Taking into consideration the extra information received through PM, my answer is yes, it is possible to take a point on a tab, then switch to other one and use that point as reference for a draw operation. Please see example below:

(setvar "CTAB" "Model")
(setq point1st (getpoint "\nIndicate insertion point: "))
(setvar "CTAB" (car (layoutlist)))
(command "_CIRCLE" "_non" point1st 5.0)

But, I'm not sure how to pause the routine evaluation to allow user to indicate the new tab. You may do that by a dialog or by a prompter (GETSTRING with INITGET), although this may not be reliable for a long list of layouts, long and/or based on a patter names for layout or even usage of space(s) on layout names.

I hope someone else can suggest you a better solution.

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