LABEL MULTIPLE POLYGONS WITH AREA LABEL

LABEL MULTIPLE POLYGONS WITH AREA LABEL

Anonymous
Not applicable
1,760 Views
8 Replies
Message 1 of 9

LABEL MULTIPLE POLYGONS WITH AREA LABEL

Anonymous
Not applicable
Hi,
I have a series of closed polygons and would like to label each with it's area from the object properties.
What is the best way to do this?

Can anyone help me please.
Regards
R
0 Likes
1,761 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable

Use Field might be easiest way.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,
I have a series of closed polygons and would like to label each with it's area
from the object properties. What is the best way to do this? Can anyone help
me please. Regards R
0 Likes
Message 3 of 9

HJohn1
Advocate
Advocate
Norman could you explain how to do that using fields? I don't use fields, but would like to see how to get the area of the polyline into the field. TIA
0 Likes
Message 4 of 9

Anonymous
Not applicable

1. Open a drawing in Acad

2, Enter "Field" at command line;

3. Highlight "Object" in Field names:"
listbox;

4. Click small button to pick a
polyline;

5. In "Property:" list box, select
"Area";

6. Choose appropriate format.

7. Click OK to insert Field text
somewhere.

8. Re-shape the polyline so that its area is
changed.

9. Regen the drawing, you'll see the field text
(area's value) changes accordingly.

 

You can also manipulate a field from VBA code. A
field is just a AcadMText or AcadText with IAcadMText2/IAcadText2 interface. See
AutoCad VBA help on IAcadMText2/IAcadText2 for how to use VBA code to create
Field.

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Norman
could you explain how to do that using fields? I don't use fields, but would
like to see how to get the area of the polyline into the field.
TIA
0 Likes
Message 5 of 9

HJohn1
Advocate
Advocate
Norman, thank you very much for your help. I don't know why I never looked into fields before, but I will for now on. I could not find any information about the IAcadMText2 and IAcadText2 reference in the VBA documentation on the help folder of AutoCAD. I am using AutoCAD 2007. Could you let me know where to find this information, which document?
0 Likes
Message 6 of 9

Anonymous
Not applicable

Simply go to Acad VBA IDE and look into Object
Browser. There are quite some objects named like IAcadxxxx2[3], which were added
into Cad object model and used for adding new functionalities to existing Acad
objects when AutoCAD evolves with each new version.

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Norman,
thank you very much for your help. I don't know why I never looked into fields
before, but I will for now on. I could not find any information about the
IAcadMText2 and IAcadText2 reference in the VBA documentation on the help
folder of AutoCAD. I am using AutoCAD 2007. Could you let me know where to
find this information, which document?
0 Likes
Message 7 of 9

HJohn1
Advocate
Advocate
Norman you need to excuse my ignorance but I can't find any reference to either one of these interfaces in the object model. I look into both AutoCAD 2007 and AutoCAD/ObjectDBX type libraries. The ObjectDBX library contains some IAcadxxx objects but not the IAcadMtext2 or IAcadText2. I found a fieldcode example where an IAcadText2 is used, but I can't run it. I get a "User-defined object not defined" error. Could you please tell me where you found these objects?
0 Likes
Message 8 of 9

Anonymous
Not applicable

OK, my main working computer still use Acad2006,
these IAcadxxxx stuff were introduced for added feature of Text and block, that
is, Field, Dynamic Block... in order to keep Acad's compatibility within the
same version of multiple releases (acad2004-2006, V16).

 

In V17 (Acad2007-2009), most of the IAcadxxxxstuff
were merged into AcadText.....

 

So, in Acad2005/6, the AcadText does not have
FieldCode() method, it only exists in IAcadText2. You have see it in VBA help
file.

 

However, in Acad2007/8, that sample code does not
run (Acad does a very poor help file update between release, they are so busy to
rush out yearly new release and hope people for get anything linked to older
versions.

 

Since Field is simply a AcadText/MText with
field code, you need to change the sample code

 

from

 

Dim textObject As IAcadText2

 

to

 

Dim textObject As AcadText

 

Then the code will run.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Norman
you need to excuse my ignorance but I can't find any reference to either one
of these interfaces in the object model. I look into both AutoCAD 2007 and
AutoCAD/ObjectDBX type libraries. The ObjectDBX library contains some IAcadxxx
objects but not the IAcadMtext2 or IAcadText2. I found a fieldcode example
where an IAcadText2 is used, but I can't run it. I get a "User-defined object
not defined" error. Could you please tell me where you found these
objects?
0 Likes
Message 9 of 9

HJohn1
Advocate
Advocate
Norman, thank you again. I finally noticed that both the AcadMtext and AcadText objects have fieldcode methods.
0 Likes