PDA

View Full Version : Using fields in a block to display x,y coords



ajzoch
2007-06-11, 04:09 PM
I'm not very familiar with using fields in my drawings but I've come across a need for them. What I'd like to do is create a block consisting of a circle and a field that display the coordinates of the center of that circle. Then I can copy the block to each point I need to show the coordinates of.

It seemed simple enough, but for some reason, once the block is made all the fields display 0,0 and won't update with the actual coordinates. I've tried making a block with a field as text and another with the field as an attribute with both giving me the same result. It makes me wonder if there's a system setting that I should change or something equally simple but I can't seem to find any information of anything like this.

rdaniel
2007-06-11, 04:53 PM
There are a couple of ways that you can do this. Either through a block placeholder or through a tag after the block has been placed. Just depends if you want the tag separate from the block or all one item. Personally, I prefer the in-block method.

For the block placeholder - insert a field in your attribute default and select block placeholder from the list. Then select location. You can format it however you want. (see attached).

We also have done the tag method for a pier-location schedule. We have the piers as blocks, tag their location with a tag and then schedule them. I can share those if you are interested.

rkmcswain
2007-06-11, 04:56 PM
Create your block with two ATTDEFs.
After the block is made, run the ._DDATTE command.
For the X value, right click and choose Insert Field
Choose Object, select the block, then choose Position.
Check the "X" value, set the format, press OK.
Repeat for the Y value.

Copy and/or move this block around and REGEN to see updates.

Mike.Perry
2007-06-12, 05:48 AM
Hi

Additionally you may like to look at the following...

Dynamic block with attributes that display X, Y, and Z values

Have a good one, Mike

Mlabell
2007-06-12, 12:07 PM
Also what is your "fieldeval" set to? Set it to 31, regen twice if the answer does not update, maybe try recreating the block with new attributes. For some reason this works. If it doens't if you could possibly post the block we could dissect the problem much easier.

Avatart
2007-06-12, 12:48 PM
Veering off course slightly, I have a routine that will place text of the co-ordinates of any block, or other filtered for object, in your drawing.

It does a few other things besides, like replacing one block with another in all selected locations, that sort of thing.

Would that be of use? I can post it up if so.

ajzoch
2007-06-12, 09:24 PM
Create your block with two ATTDEFs.
After the block is made, run the ._DDATTE command.
For the X value, right click and choose Insert Field
Choose Object, select the block, then choose Position.
Check the "X" value, set the format, press OK.
Repeat for the Y value.

Copy and/or move this block around and REGEN to see updates.
That worked, thanks. I still don't see why it won't work when the field is added as the default value, but at least I got it to work now.

Animal
2007-11-30, 03:30 PM
Is there any way to display the X & Y co-ordinates for multiple points in a dynamic block? I have a set of pile cap blocks that I'd like to have co-ords displaying the centre of each pile. I've tried assigning the attribute to a point on the centre of each circle, but when inserted into the drawing it just tells me how far away from the insertion point they are, not the actual world co-ordinates.

rdaniel
2007-11-30, 03:56 PM
Is there any way to display the X & Y co-ordinates for multiple points in a dynamic block? I have a set of pile cap blocks that I'd like to have co-ords displaying the centre of each pile. I've tried assigning the attribute to a point on the centre of each circle, but when inserted into the drawing it just tells me how far away from the insertion point they are, not the actual world co-ordinates.

Sure. There are two ways I have accomplished this. The first is to create a a pier multi-view block and then create a tag that reads in the coordinates. This one is best if you want to create a location schedule table because you can schedule these objects. (not sure if you can schedule regular blocks or not?)

The other way is to make the "tag" integral with the block by using a field in the attribute. The only catch is that when you insert it into a drawing, the field will default to ##### and you have to reset it to read in its own x,y coordinates. My theory to why it does this is that the field is trying to read in the coordinates for an object which isn't in the drawing yet (because you are in the process of inserting it). So then you take 20 seconds to re-format the field and you can then copy the block all over the drawing (Note: that you will have to update the fields when you move / copy them around).

To reformat the field, double click on the field and match the settings in the attached image. Also attached a .dwg with a block example. Hope it helps.

** Just noticed that Mike Perry referenced a post above as well - looks like it was pretty thorough.

*** and looks like I made a similar post here in June..... so now you have the similar information worded in two ways.:lol:

Animal
2007-12-03, 08:48 AM
Thanks for that reply Randall, although I still appear to be struggling. I've tried putting attribute tags into the block, but unless they reference the insertion point, they don't give true co-ordinates when inserted in the drawing - only how far away from the insertion point they are, so in the case of a 2-pile cap, they display -300 & 300 as the pile centres no matter where they are placed on the drawing.

I've no idea about pier multi-view blocks. I did a search and it looks like they are 3D blocks which I don't think I want for this application.

Cheers anyway

rdaniel
2007-12-03, 06:18 PM
Thanks for that reply Randall, although I still appear to be struggling. I've tried putting attribute tags into the block, but unless they reference the insertion point, they don't give true co-ordinates when inserted in the drawing - only how far away from the insertion point they are, so in the case of a 2-pile cap, they display -300 & 300 as the pile centres no matter where they are placed on the drawing.

Can you post the file you are working on?

Animal
2007-12-04, 07:43 AM
No problem, here you go. Cheers

rdaniel
2007-12-04, 03:31 PM
Animal,

You'll see that I adjusted the attributes on the right pier. The point locations for each pier were reading in their position in relation to the block insertion point, so I added the blocks overall position to it to then relate it to the drawings coordinates. The attribute is now a simple formula: E: Position X + PierX. Follow suit for the pier on the left.

Let me know if that's what you needed.

Animal
2007-12-04, 06:32 PM
That's the baby! Now you're making me feel like a complete muppet 'cos I just can't see how you've done it.

If I edit the attribute it looks no different to the other one. I've just spent half an hour looking at it and I'm none the wiser. HOW, WHAT, WHERE, WHY???

Could you explain for the hard of thinking how you actually go about whatever it is you did? I would be most greatful.

Many thanks

Paul

rdaniel
2007-12-04, 06:39 PM
Paul, I'm just using a formula. Double click on an attribute and notice that the a field is inserted as the value. Double click on that field to see how it is comprised. You will then see the formula displayed (as in the attached image). There are two fields in the formula - one for the overall coordinates and one for the piers distance from the insertion point.

Animal
2007-12-04, 07:03 PM
Ah, I've just edited the attribute on the block & it's shown me the same details as your screen shot. I was trying to edit it inside the block editor and everything was coming up blank.

[/pause for more fiddling]

Eureka! I didn't know you could insert fields into the field expression. (I've only just started using these things)

So the formula would be [Pile1 X] + [Position X]

Thank you for your patience, your a star.

Right, I've been home for an hour, it's now 7pm and WAY past tea time...

I'll play with them at work in the morning

Have a good day, sir.

rdaniel
2007-12-04, 07:07 PM
You got it. :beer:

jdrewreed
2009-03-17, 03:22 PM
I'm guessing that AutoCAD LT lacks some of the features discussed here. I have been able to manipulate an already created block that has field attributes, but unable to edit the fields themselves or create my own. I can change the geometry of the provided block, but I need the field to read to hundredths and the one provided only reads integer values.

It seems the _ddatte command has limited capability in AC Lt and that's what causing the snag for me.

shaun.farrell.153759
2009-12-21, 12:56 PM
We have managed to achieve this, but when the drawing is then referenced into a sheet file all the values for all the blocks reset to 0!!!
Is this a standard "feature" of AutoCAD?

Yancka
2009-12-22, 09:29 PM
We have managed to achieve this, but when the drawing is then referenced into a sheet file all the values for all the blocks reset to 0!!!
Is this a standard "feature" of AutoCAD?

Don't know. I just made a block displaying X,Y coordinates, XATTACHed the file with several blocks to another file and everything was fine. I did this on AutoCAD (vanilla) 2007.

What version are using you? And is the result same if you take 2 clean files, into 1 of them insert few blocks and then reference that file into another one? Could you share your "wrong" files here?

shaun.farrell.153759
2010-01-28, 10:05 AM
We forwarded our drawings to Autodesk and they have been able to recreate the problem and it looks to be a bug. So now we are in the limbo of how much or a priority they make it.


Don't know. I just made a block displaying X,Y coordinates, XATTACHed the file with several blocks to another file and everything was fine. I did this on AutoCAD (vanilla) 2007.

What version are using you? And is the result same if you take 2 clean files, into 1 of them insert few blocks and then reference that file into another one? Could you share your "wrong" files here?

humanwindsock
2016-11-08, 06:42 AM
Hi everyone.

Replying to an old post I know but it's about exactly the topic I'm working on. I'm trying to create a similar block to the pile cap but I also need to be able to rotate the block and have the points correctly report WCS coordinates. Does anyone know if this is possible? I haven't played around with trying to add trigonometric formulas to fields yet. I guess that may be a solution but it's somewhat complicated. Any easy work around?

Cheers,

Phil

luisfnunes
2017-07-07, 09:55 AM
Is it possible to have such a field in the paperspace (in a layout...) but referencing an object in the modelspace?
(my idea is to have a field in a layout that gathers the X coordinate of a point on modelspace ...)

MMccall
2017-07-07, 11:42 AM
I've done this with a field in paper space to the area of a polyline in model space so I don't see why it wouldn't work for the X a point as well.

I made the field while in model space so I could select the object target for the field and then used CHspace to move it to paperspace thru a viewport

rajesh2910
2017-08-08, 07:46 AM
Hi,

I have created a block to have the coordinates using formulas in fields. In addition to this, i would like to have the third digit after decimal rounded to nearest integer.

Ex: In X = -317.038 and in Y= -2.928, i want those values to be rounded to X=-317.040 & Y= -2.930.

As of now this is the formula i have used as of now. rxof(w2u(20552.8421, 404985.7164, 0.0000)/1000).

Request your help to solve this.

Thank you.

Avatart
2017-08-08, 08:56 AM
Hi,

I have created a block to have the coordinates using formulas in fields. In addition to this, i would like to have the third digit after decimal rounded to nearest integer.

Ex: In X = -317.038 and in Y= -2.928, i want those values to be rounded to X=-317.040 & Y= -2.930.

As of now this is the formula i have used as of now. rxof(w2u(20552.8421, 404985.7164, 0.0000)/1000).

Request your help to solve this.

Thank you.

There is a post on this blog: http://blog.jtbworld.com/2005/04/autocad-2006-and-formulas-in-fields.html that should help you out.

Other than that, if you want rounding to two decimal places, you can set that in the precision field. If you need to show a trailing zero, then that could be suffixed text. Bit of a hack, but it should look right.

rajesh2910
2017-08-08, 11:28 AM
Hi, thank you. I tried that blog, couldnt understand it, so i tried your second suggestion and it did :-)

Thanks, Rajesh