Jump to content

Possible to give a node a Z value from text?


Clifford169

Recommended Posts

Long timer user first time poster.

 

I have an old survey that we don't have the raw data for anymore. There are levels associated (in text form) to the nodes we have created from LSS, however the nodes themselves are all 2D.

 

Is there a way to tell those nodes to shift their Z value to the height in the text line? I'm used to using LISPs though I'm not much of a writer for them!

 

Looking forward to your responses.

Link to comment
Share on other sites

Long timer user first time poster.

 

I have an old survey that we don't have the raw data for anymore. There are levels associated (in text form) to the nodes we have created from LSS, however the nodes themselves are all 2D.

 

Is there a way to tell those nodes to shift their Z value to the height in the text line? I'm used to using LISPs though I'm not much of a writer for them!

 

Looking forward to your responses.

 

hi welcome to CADtutor

there are many examples

here's quick & dirty

(defun c:TXZ (/ ss i l[color="red"] vo p[/color])
[color="red"](princ "\nSelect TEXT.. ")[/color]
 (if (setq ss (ssget ":L" '((0 . "TEXT"))))
   (repeat (setq i (sslength ss))
     (setq i (1- i) l
     (mapcar ''((x) (vlax-get (setq vo (vlax-ename->vla-object (ssname ss i))) x))
      '(TextString InsertionPoint)
      ))
     (if (numberp (read (car l)))
[color="red"](progn[/color]
(vla-put-InsertionPoint vo (vlax-3d-point [color="red"](setq p[/color] (list (caadr l) (cadadr l) (atof (car l))))))
[color="red"](entmakex (list '(0 . "POINT")(cons 10 p)))[/color]
[color="red"])[/color]
) 
     ) 
   ) 
 (princ)
 ) 

Edited by hanhphuc
Link to comment
Share on other sites

hi welcome to CADtutor

there are many examples

here's quick & dirty

(defun c:TXZ (/ ss i l)
 (if (setq ss (ssget ":L" '((0 . "TEXT"))))
   (repeat (setq i (sslength ss))
     (setq i (1- i) l
     (mapcar ''((x) (vlax-get (setq vo (vlax-ename->vla-object (ssname ss i))) x))
      '(TextString InsertionPoint)
      ))
     (if (numberp (read (car l)))
(vla-put-InsertionPoint vo (vlax-3d-point (list (caadr l) (cadadr l) (atof (car l)))))
) 
     ) 
   ) 
 (princ)
 ) 

 

This is excellent for giving the text a Z value; is there a way to give the node it is next to the same value?

Link to comment
Share on other sites

code updated

 

Thanks. I have also come to a similar result using something additional from another thread, which creates a point at the text insertion. The above code doesn't seem to provide the point with a Z value, however.

 

I'm happy with how this acts as it stands. My next question would be, is there a quick way to match the Z properties of a text object to a block/line?

Link to comment
Share on other sites

... is there a quick way to match the Z properties of a text object to a block/line?

Yes it is possible by matching to the nearest point (brute force) but there are problems time to process many points also how to over come if more points share the same coordinates on the block line etc..

Link to comment
Share on other sites

Yes it is possible by matching to the nearest point (brute force) but there are problems time to process many points also how to over come if more points share the same coordinates on the block line etc..

 

Annoyingly but fortunately, the surveyor on the job has managed to find his original survey data, so I will be able to process it through from scratch and retrieve the data I need from that.

This has been a problem before though, and I'm sure this info will be useful for future tasks. Thanks for all your help thus far!

Link to comment
Share on other sites

Very useful. I wonder if it would be possible to get this to work with a attributed block in stead of a plain text.Or maybe this allready it exists. The labeling comes in block form in many occasions.

Link to comment
Share on other sites

Yes our surveyors are using Geomax as we use lisp to output data attributes as point ID, with 3 tags Index Level Code and a node, the attribute layer inserted base on surveyor's point code. It's easy to handle using express tools ATTOUT ATTIN or customized lisp etc to manipulate these datas

Link to comment
Share on other sites

1 thing to watch out for when converting text is where is the text relative to the point, if you use insertion point say bottom left but we can make text so the decimal point is the actual point location so a x,y error. To get around this just check and move "all" text if required before making 3d points. Most times its better than nothing.

Link to comment
Share on other sites

Our other civil software can place the text say 123.456, the actual survey point lines up with the decimal point 123X456 so the insert point lower left is offset from the true location of the point. A very slight error in the x,y. I have had text come in like a metre away from the actual survey point its all about how it was created. I have 30 years doing this.

Link to comment
Share on other sites

@BIGAL:

I do not doubt your experience but do doubt the wisdom of this approach. Unless these texts are in fact custom entities, choosing a different font or text size must really screw things up...

Link to comment
Share on other sites

@BIGAL:

After reconsideration I come to the conclusion that your interpretation may in fact be wrong. For most "TEXT" alignments the insertion point (the point a user would snap to) is represented by the TextAlignmentPoint (group code 11) and not the InsertionPoint (group code 10). It seems you may not be aware of this. So IMO the offset you perceive probably does not exist if you look at the correct property.

Link to comment
Share on other sites

hey guys sorry for interrupting :oops:

 

Our other civil software can place the text say 123.456, the actual survey point lines up with the decimal point 123X456 so the insert point lower left is offset from the true location of the point. A very slight error in the x,y. I have had text come in like a metre away from the actual survey point its all about how it was created. I have 30 years doing this.

sometimes we received these kind of topo drawing from consultant where 2D level text without node/point :shock:

we can not use text insertion point as node position due to text is

1.BL-justified

2.we figured out their surveyed node should be nearby text Bottom Centre or offset somewhere "decimal point"

3.sometimes with different rotation eg: 45° etc..

 

CDEIXyt.png?1

...choosing a different font or text size must really screw things up...

This is the fact.. :ouch:

 

... your interpretation may in fact be wrong

 

Maybe Roy misunderstood about BIGAL's concept, in fact it's just a normal AcDbText entity, 3rd party software only puts Text & node position in different way, to clarify

 

Have a look in this

LOT A150 TOPO.dwg

Edited by hanhphuc
upload drawing & image
Link to comment
Share on other sites

@hanhphuc:

Well, what can I say, I am stunned and I stand corrected.

I am hardly a 'spring chicken' myself, so I have seen some weird CAD stuff. But this takes the biscuit.

My apologies to BIGAL. :oops:

Link to comment
Share on other sites

No worries. Thanks hanhphuc went looking for a sample as well I have seen text 750 mm away from actual survey point. The 52mm error is probably acceptable when you are starting with nothing.

 

This is the screen for our other software note the horizontal offset value.

attachment.php?attachmentid=60106&cid=1&stc=1

Screen Shot 12-12-16 at 12.49 PM.PNG

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