hatch style in a block

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
lulu
Posts: 25
Joined: 12 Nov 2009, 19:55

hatch style in a block

Post by lulu » 20 Jul 2010, 18:54

Hi,
I have an AutoCAD that contains some blocks (insert). Is it possible to act on the single elements that compose the block?
Particularly, I need to modify the style of an hatch.

Thank you,
lulu.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: hatch style in a block

Post by support » 21 Jul 2010, 10:44

Hello.
Entities within the block can be accessed as insert's block entities. For example

Code: Select all

CADImage image;
CADInsert insert;
CADHatch hatch;

// .......

    (((CADEntity)image.Converter.Entities[i]).EntType == EntityType.Insert)
    {
        insert = (CADInsert)image.Converter.Entities[i];
        if (((CADEntity)insert.Block.Entities[j]).EntType == EntityType.Hatch)
        {
            hatch = (CADHatch)insert.Block.Entities[j];
            hatch.HatchStyle = CADHatchStyle.Solid;
        }
    }
will access style of the hatch object if insert placed with i index in converter's entities collection and hatch placed with j index in block's entities collection.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

lulu
Posts: 25
Joined: 12 Nov 2009, 19:55

Re: hatch style in a block

Post by lulu » 21 Jul 2010, 18:29

Hi Alexander,
thank you for your reply, but I have another problem now. The type of the hatches (inside the blocks) in the AutoCAD file results 'CurvePolygon', and I don't understand why it happens... How can I convert a CADCurvePolygon in a CADHatch?

Thanks,
lulu.

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: hatch style in a block

Post by support » 22 Jul 2010, 17:05

Hello lulu,
CADCurvePolygon object can't be cast to CADHatch object. However CADHatch is the descendant of CADCurvePolygon. You can create new Hatch object, fill its properties by corresponded values from CurvePolygon and specify HatchStyle.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply