Jump to content

Recommended Posts

Posted

Hey everyone,

 

I am trying to figure out how to hide some LISP code from displaying in the command line when using a CUI custom command.

I am trying to add an area in my CUI for the user to set some variables that will be used on multiple LISPs.

I current made a custom command that has just this....

^C^C(setq F2B (getreal "Enter Front to Back slopes: "))

But when I click the buttom in the CUI I get this...

^C^C(setq F2B (getreal "Enter Front to Back slopes:")) Enter Front to Back slopes:

Is there anyway to hide the LISP code or would I have to take a different approach?

 

Thanks,

 

Posted

So I found out the answer to my own question.

 

If you are looking to hide part of you macro in the command line, you needs to wrap it a "^P" (Ignore the quotes)

For example, here is a simple lisp code that I want to use to ask the user to set some variables that can / will be used in multiple lisps.

^C^C^P(setq F2B (getreal "Enter Rise for Front to Back slopes: "))

By adding the ^P it will no longer show the "CODE" part of it, but will show the prompt of "Enter Rise for Front to Back slopes: " on the command line.

  • 9 months later...
Posted

Can you then have a different Lisp read the F2b value? 

Posted

A suggestion use a "\n" in the (getreal "\nEnter Rise...) this will push a new line on the command line.

 

If the F2b is a global variable then any lisp can read it, but that is not necessarily a good idea. Its easier to do a double lisp in the cui. So load the program and call a defun passing it the f2b value.

 

^C^C^P(setq F2B (getreal "Enter Rise for Front to Back slopes: "))(load "mylisp")(mylisp f2b)

 

I use LDATA when I want values stored in a dwg they stay in the dwg and can be changed.

  • Thanks 1
Posted

@CivilTechSource Yes you can make the variable global by not clearing it in the lisp routine. 

If you aren't familiar with what I am taking about in a lisp you write at the top this.. 

(defun c:lisp ( / variable1 variable2) 

If you set a value to variable3 as long as it's not in the list like variable1 is then it's consider a global variable which can be used by multiple lisps. Typically I see people use something like global:variable1 to know which is which. 

 

Hope that helps. 

  • Like 1
Posted

That is really handy to know! Would it be wise to create a Textbox in the CUI where the user can input a number eg. text height and then all lisps that run can use the text height specified globally?

Posted

@CivilTechSource You could do it that way, but I wouldnt . I would use the built in Styles and have the user select which style to use.

If using AutoCAD you should expect the user to have a certain level of usability in the work space.

If they dont have the level then do not make it easier for them, make them use CAD the way its intended.

By doing that you are making sure that they learn CAD and also use the office CAD Standards how they are intended to be used.

  • Agree 1

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