Skip to content

How to create Hatch entity with predefined pattern ? #519

Answered by wdhust
wdhust asked this question in Q&A
Discussion options

You must be logged in to vote

Through some research and analysis, I found a solution.
Here is the code.

public static void TestCreatePredefinedHatch()
{
    var doc = new CadDocument();

    var hatch = new Hatch();

    var pline = new Hatch.BoundaryPath.Polyline();
    pline.Vertices.Add(new XYZ(0, 0, 0));
    pline.Vertices.Add(new XYZ(20, 0, 0));
    pline.Vertices.Add(new XYZ(20, 10, 0));
    pline.Vertices.Add(new XYZ(0, 10, 0));
    pline.Vertices.Add(new XYZ(0, 0, 0));

    var path = new Hatch.BoundaryPath();
    path.Edges.Add(pline);
    path.Flags |= BoundaryPathFlags.Polyline;
    hatch.Paths.Add(path);

    //
    const string patFilePath = @"D:\acadiso.pat";
    var hatchPatternDict = HatchPatternInfo.L…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by wdhust
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants