pttr Posted March 17, 2023 Share Posted March 17, 2023 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! Quote Link to comment Share on other sites More sharing options...
Steven P Posted March 17, 2023 Share Posted March 17, 2023 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 1 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 18, 2023 Share Posted March 18, 2023 (edited) 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. 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 March 18, 2023 by BIGAL 2 Quote Link to comment Share on other sites More sharing options...
pttr Posted March 27, 2023 Author Share Posted March 27, 2023 (edited) Many tanks! @Steven P your line of code was the one missing for me, then used Lee Macs "setdynpropvalue" and it worked Edited March 27, 2023 by pttr Quote Link to comment Share on other sites More sharing options...
pttr Posted March 28, 2023 Author Share Posted March 28, 2023 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? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 28, 2023 Share Posted March 28, 2023 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 Quote Link to comment Share on other sites More sharing options...
pttr Posted March 30, 2023 Author Share Posted March 30, 2023 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.