How to use libdxfrw creat a DRW_DimLinear?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to use libdxfrw creat a DRW_DimLinear?

JacquesChen
Hello,
I am a structural engineer with a little bit of control over computer programming.
My job is structural design, as well as drawing construction drawings.
Currently I am using libdxfrw to program the rebar drawing of the box culvert.  At present, I dont know how to add a dimension(DRW_DimLinear). I am not a professional programmer, so this problem can't be solved. All the code in librecad is too hard to me.

My current drawing interface looks like this:
//sample 1
void DrawFunc::AddText(string Str, Point Pt, double H, double W, double Deg, string Align, string Layer)
{
        DRW_Text Text;
        Text.secPoint = DRW_Coord(Pt.X, Pt.Y, 0.0);
        if (Align == "Center")
        {
                Text.alignV = DRW_Text::VMiddle;
                Text.alignH = DRW_Text::HMiddle;
        }
        else if (Align == "Middle")
        {
                Text.alignV = DRW_Text::VBottom;
                Text.alignH = DRW_Text::HCenter;
        }
        else
        {
                Text.alignV = DRW_Text::VBottom;
                Text.alignH = DRW_Text::HLeft;
        }

        Text.height = H;
        Text.widthscale = W;
        Text.text = Str;
        Text.angle = Deg;
        Text.style = "DltTextStyle";
        Text.layer = Layer;
        DxfInter->addText(Text);
}

//sample 2
void DrawFunc::AddRec(Point Pt1, Point Pt2, string Layer)
{
        DRW_Line Line1, Line2, Line3, Line4;

        Line1.basePoint = DRW_Coord(Pt1.X, Pt1.Y, 0.0);
        Line1.secPoint = DRW_Coord(Pt2.X, Pt1.Y, 0.0);
        Line1.layer = Layer.c_str();
        DxfInter->addLine(Line1);

        Line2.basePoint = DRW_Coord(Pt1.X, Pt2.Y, 0.0);
        Line2.secPoint = DRW_Coord(Pt2.X, Pt2.Y, 0.0);
        Line2.layer = Layer.c_str();
        DxfInter->addLine(Line2);

        Line3.basePoint = DRW_Coord(Pt1.X, Pt1.Y, 0.0);
        Line3.secPoint = DRW_Coord(Pt1.X, Pt2.Y, 0.0);
        Line3.layer = Layer.c_str();
        DxfInter->addLine(Line3);

        Line4.basePoint = DRW_Coord(Pt2.X, Pt1.Y, 0.0);
        Line4.secPoint = DRW_Coord(Pt2.X, Pt2.Y, 0.0);
        Line4.layer = Layer.c_str();
        DxfInter->addLine(Line4);
}

//sample 3
void DrawFunc::AddCir(Point Pt0, double R, string Layer)
{
        DRW_Circle Cir;
        Cir.basePoint = DRW_Coord(Pt0.X, Pt0.Y, 0.0);
        Cir.radious = R;
        Cir.layer = Layer.c_str();
        DxfInter->addCircle(Cir);
}

Now, I want creat a interface like this:
void DrawFunc::AddDimLinear(Point Pt1, Point Pt2, Point Pt3, string Layer)//may be more parameter
{
}