Jump to content
Developer Wiki and Function Reference Links Read more... ×
Nebeor

How to set Hatch Pattern by sdk?

Recommended Posts

Posted (edited)
VWObject errorBox(gSDK->CreateRectangle(WorldRect(WorldPt(0,0),WorldPt(1000,1000))));
InternalIndex hatchIndex;
gSDK->NameToInternalIndexN("ErrorHatch",  hatchIndex);
//VWPattern hatchPat(hatchIndex);
//errorBox.GetObjectAttribs().SetFillPattern(hatchPat);
gSDK->SetFillPat(errorBox,hatchIndex);

Hello there,

I would like to add a hatch pattern that exists in my resource browser to my 2D rectangle (as if I would just drag and drop), but this does not work, what am I doing wrong?  

Edited by Nebeor

Share this post


Link to post

If I remember well and if I am not mixing it up with something else, you have to use -hatchIndex to set an hatch.

 

(I cannot find back a discussion I have in mind, so probably it was a private email exchange and not a post in this forum or in the old SDK mailing list.)

Share this post


Link to post

Thanks @Nicolas Goutte but,

Isn't that just what i'm trying to do?

what do you mean with the '-' before hatchIndex?, I'm thinking I have to set a variable somewhere.

Share this post


Link to post

You have to negate the internal index when setting:

 

gSDK->SetFillPat(errorBox, -hatchIndex);

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×