Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Show Dimentions #409

Open
LauraBolanos05 opened this issue Aug 24, 2022 · 2 comments
Open

Show Dimentions #409

LauraBolanos05 opened this issue Aug 24, 2022 · 2 comments
Labels

Comments

@LauraBolanos05
Copy link

Hi there
I had a list with the Coordenates to create a square but I want to show the dimension of the lines, Using this code I can show the dimensions
doc.AddEntity(entity);
doc.AddEntity(ad);

But when I put everything together into a Block the dimensions does not show...
//block.Entities.Add(entity);
//block.Entities.Add(ad);
//Insert insert = new Insert(block);
//doc.AddEntity(insert);

My final goal with this is to show the dimensions of the line with a specific width, in this moment the numbers look very small, I tried to change the height and width of the text using the AlignedDimension methods but anything had changed

Hope you can help me
Regards

DxfDocument doc = new DxfDocument();
foreach (List _Coordenates in lst_Coordenates)
{
for (int i = 0; i < (_Coordenates.Count() - 1); i++)
{
Coordenates initial = _Coordenates[i];
Coordenates next = _Coordenates[i + 1];

                if (i < (_Coordenates.Count() - 1))
                {
                    Line entity = new Line(new Vector2(initial.x_coordenate, initial.y_coordenate), new Vector2(next.x_coordenate, next.y_coordenate));
                    AlignedDimension ad = new AlignedDimension(new Vector2(initial.x_coordenate, initial.y_coordenate), new Vector2(next.x_coordenate, next.y_coordenate), 50);


                    ad.Style.TextStyle = TextStyle.Default;
                    ad.Style.TextStyle.Height = 50.0;
                    ad.Style.TextStyle.WidthFactor = 10.0;

                    ad.Style.TextHeight = 50.0;

                    ##with this I can show the dimentions of all lines but the measurement looks very small
                    **doc.AddEntity(entity);
                    doc.AddEntity(ad);**

                    //Block block = new Block("DimensionBlock" + Counter);
                    //block.Record.Units = DrawingUnits.Inches;
                    //AttributeDefinition attDefINCH = new AttributeDefinition("MyAttributeINCH" + Counter);
                    //attDefINCH.Height = 10.0;
                    //block.Entities.Add(entity);
                    //block.Entities.Add(ad);
                    //Insert insert = new Insert(block);
                    //doc.AddEntity(insert);
                }
            }
        }
@Snailya
Copy link

Snailya commented Aug 25, 2022

I have the same problem.
If you use refedit to open the block in autocad and save the block without acutally no operation, you could find that the autocad add an anonymous block to the file.
Therefore, I think that might be the entity that lacks to dipslay as expected.
I don't known how to solve it. Currently, I'll move the dimension out of my block.

@haplokuon
Copy link
Owner

About why the dimensions does not appear when embedded into a block, read this #342, you can also read #98 about other issues with dimensions inside blocks.

About why the change to the text height of the dimension style is not applied, read #375, a similar thing is happening when changing properties of the text style of the dimension style.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants