Jump to content

Object Attached Multileader


ksperopoulos

Recommended Posts

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?

PipeInfo.jpg

Link to comment
Share on other sites

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\"" 

Link to comment
Share on other sites

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! :thumbsup:

Tharwat has likely rendered my suggestions obsolete, which is a good thing. :D

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

@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 by Tharwat
mistake in spelling on to in
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 .

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