How to use libdxfrw creat a DRW_DimLinear?

Previous Topic Next Topic
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?

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;
                Text.alignV = DRW_Text::VBottom;
                Text.alignH = DRW_Text::HLeft;

        Text.height = H;
        Text.widthscale = W;
        Text.text = Str;
        Text.angle = Deg; = "DltTextStyle";
        Text.layer = Layer;

//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();

        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();

        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();

        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();

//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();

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