ksperopoulos Posted December 17, 2012 Share Posted December 17, 2012 I am trying to create a lisp that reads the Z elevation of an object and writes it in a multileader's text and also have the multileader (with text) be associated to this object. I am starting with just trying to read the elevation and write it to the multileader text. The object is a piece of pipe and has both a top and bottom elevation. Is there a way to read only one of them? And if so, is there a way to only read the numbers instead of the prefix and the numbers? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 17, 2012 Share Posted December 17, 2012 e.g. (defun PeelString (st / s) (if (eq (type st) 'STR) (progn (foreach x (vl-string->list st) (if (not (or (< 65 x 90) (< 97 x 122))) (setq s (cons x s)) ) ) (vl-list->string (reverse s)) ) ) ) (peelstring "TOP 11'-7 1/4\", BOT 10' -10 5/8\"") Result . " 11'-7 1/4\", 10' -10 5/8\"" Quote Link to comment Share on other sites More sharing options...
Dadgad Posted December 17, 2012 Share Posted December 17, 2012 I suggest you start by creating a FIELD, which points to an OBJECT which you specify. Once that OBJECT has been identified there will be quite a list of properties available in the FIELD definition dialog. I imagine that you can choose either of them from that list. Additionally should you want to, you can add a PREFIX or SUFFIX to that information, which I believe will be displayed entirely numerically. Once you have gotten the hang of that FIELD CREATION you can create a custom MULTILEADER and include such a FIELD inserted into, or as an ATTRIBUTE. See this post from Ammobake http://www.cadtutor.net/forum/showthread.php?75747-Is-there-an-option-to-circle-multileader-text as it may prove helpful. Tharwat to the rescue! Tharwat has likely rendered my suggestions obsolete, which is a good thing. Quote Link to comment Share on other sites More sharing options...
ksperopoulos Posted December 17, 2012 Author Share Posted December 17, 2012 I suggest you start by creating a FIELD,... The pipe is drawn with a 3rd party program and when I try using a field, these properties are not available for use. Thanks for the suggestion though. @Tharwat - thank you for the help. Does PeelString accept wildcards? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 17, 2012 Share Posted December 17, 2012 (edited) @Tharwat - thank you for the help. You're welcome , Does PeelString accept wildcards? No it doesn't , What you have in mind against wildcards ? Edited December 17, 2012 by Tharwat mistake in spelling on to in Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 17, 2012 Share Posted December 17, 2012 Here is a 'console demonstration' to point you in the right direction: _$ ([color=blue]setq [/color]s [color=darkred]"TOP 11'-7 1/4\", BOT 10'-10 5/8\""[/color]) [color=darkred]"TOP 11'-7 1/4\", BOT 10'-10 5/8\""[/color] _$ ([color=blue]setq [/color]i ([color=blue]vl-string-position[/color] 44 s)) 14 _$ ([color=blue]setq [/color]a ([color=blue]substr [/color]s 5 ([color=blue]-[/color] i 4))) [color=darkred]"11'-7 1/4\""[/color] _$ ([color=blue]setq [/color]b ([color=blue]substr [/color]s ([color=blue]+[/color] i 7))) [color=darkred]"10'-10 5/8\""[/color] _$ ([color=blue]distof [/color]a 4) 139.25 _$ ([color=blue]distof [/color]b 4) 130.625 Quote Link to comment Share on other sites More sharing options...
ksperopoulos Posted December 17, 2012 Author Share Posted December 17, 2012 No it doesn't , What you have on mind against wildcards ? If the prefix "BOT" changed I could have a wildcard in its place to catch anything in its location. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted December 17, 2012 Share Posted December 17, 2012 If the prefix "BOT" changed I could have a wildcard in its place to catch anything in its location. My function PeelString removes the all Alphabetic characters from the string and whatever the char is , it would be remove . 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.