Jump to content

Change visibility for the latest placed block


pttr

Recommended Posts

Hi,

I'm trying to change the visibility of the last placed block.

I could not find a way that suited me for the code below.

(defun vblty (/ Visibility1 blk )
     (setq blk (entlast))
  (if (/= Visibility1 "")
	;Place Visibility1 to block
    )
)

 

I have looked at some other topics, but the code is always a bit over my level of LISP understanding.

 

Any help is much appreciated! :)

Link to comment
Share on other sites

Lee Mac has a fairly comprehensive set of routines here ( http://www.lee-mac.com/dynamicblockfunctions.html#getvisibilityparametername ) and to use (entlast) I think you'll need to change that to be a VLA-Object something like:

 

(setq blk (vlax-ename->vla-object (entlast)))

 

He is usually pretty good with his routines and fairly easy to follow

  • Like 1
Link to comment
Share on other sites

if talking a dynamic block then yes thanks to Lee-mac 1st, then can display visibility values and choose. Works for any dynamic block as it reads the visibility values. You insert block and then visibility values are displayed.

 

Multiradio9.png.4aa769abe91d20b82e06f4b5d68d281a.png

Is this what you want as its 3 lisps, 2 are library functions the dcl and Lee-mac dynamic block functions. let me know will post code.

 

 

Edited by BIGAL
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Another problem that I have is that the visibility string is lowercase and I need to make sure that whatever value I have it always starts with an uppercase letter.

I tried using this, but it doesn't work for at strings as a variable

Tried Lee Mac´s code to but same problem

http://www.lee-mac.com/textcasefunctions.html

 

Anyone know how to change the first letter of a String as variable to uppercase?

Link to comment
Share on other sites

Strcase will change the case of a string, so abc becomes ABC, you can look at what your typed,  and look at the 1st character strange but there are 52 characters in the English alphabet from a computer perspective, so a=97 A=65 so a "c" becomes 100-32 (chr 68)

 

Useful hints

(ascii (getstring)) (ascii (substr str 1 1))

(chr x)

(substr str 1 1)

 

So can work out any 

Link to comment
Share on other sites

On 3/28/2023 at 12:24 PM, BIGAL said:

Strcase will change the case of a string, so abc becomes ABC, you can look at what your typed,  and look at the 1st character strange but there are 52 characters in the English alphabet from a computer perspective, so a=97 A=65 so a "c" becomes 100-32 (chr 68)

 

Useful hints

(ascii (getstring)) (ascii (substr str 1 1))

(chr x)

(substr str 1 1)

 

So can work out any 

Turns out It was working all along, Problem was a (,) in the start of the word it was trying to make uppercase and therefor it would not compute. Thanks for your contribution!

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