v27 How to set and turn off overrides for fills and surfaces (Not Graphic Overrides)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-10-24
10:12 AM
- last edited on
2024-09-17
01:21 PM
by
Doreena Deng
Hi All
I am in the process of upgrading another addon to v27.. This one loops through a plan and sets the pens and surfaces to the companies standards..
Back in v24, i could set an overridden cutfill fairly easily, say
element.slab.penOverride.cutFillBackgroupPen = 19;
or
element.wall.refMat.attributeIndex = 100;
In version 27 this has changed and for the life of me I can't work it out..
Question 1. How do we set these override pens and surfaces in v27
Question 2. How to we set the override to off in v27
Below is the fill overrides I am talking about
These are the surface overrides I am talking about
Any help is greatly appreciate .. TIA 🙏
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-10-24 10:37 PM - edited 2023-10-26 08:55 AM
Hi Ben,
The types behind these members changed to GS::Optional<API_PenType> APIOptional<API_PenType> and GS::Optional<API_AttributeIndex> APIOptional<API_AttributeIndex> behind the scenes. Also API_AttributeIndex changed a bit.
So to turn an override off I think you can just assign APINullValue.
To set a value for the cutFillPen you could use a cast and for refMat use ACAPI_CreateAttributeIndex:
// previous typo: elem.slab.cutFillBackgroundPen = APINULLGuid;
elem.slab.cutFillBackgroundPen = APINullValue; // correct version to turn off
elem.slab.cutFillBackgroundPen = (API_PenIndex)19; // Set override pen to 19
elem.wall.refMat = APINullValue; // Turn off
elem.wall.refMat = ACAPI_CreateAttributeIndex (100);
Hope that helps!
Bernd
Edit (2023-10-26): Fixed incorrect values/types as discussed below.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-10-26 08:10 AM
Actually, the correct code is quite different. You can't use APINULLGuid .. because cutFillBackgroundPen is a pen index - not a GUID..
There is a new boolean parameter ".hasValue" just set this to false.
My problem was I hadn't changed the MASK_SET to these new parameters and therefore it wasn't working..
ACAPI_ELEMENT_MASK_SET(mask, API_SlabType, cutFillBackgroundPen);
ACAPI_ELEMENT_MASK_SET(mask, API_SlabType, cutFillPen);
if (element.slab.cutFillBackgroundPen.hasValue) {
element.slab.cutFillBackgroundPen.hasValue = false;
element.slab.cutFillPen.hasValue = false;
}
Thanks for your help anyway Bernd 👍

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-10-24 10:37 PM - edited 2023-10-26 08:55 AM
Hi Ben,
The types behind these members changed to GS::Optional<API_PenType> APIOptional<API_PenType> and GS::Optional<API_AttributeIndex> APIOptional<API_AttributeIndex> behind the scenes. Also API_AttributeIndex changed a bit.
So to turn an override off I think you can just assign APINullValue.
To set a value for the cutFillPen you could use a cast and for refMat use ACAPI_CreateAttributeIndex:
// previous typo: elem.slab.cutFillBackgroundPen = APINULLGuid;
elem.slab.cutFillBackgroundPen = APINullValue; // correct version to turn off
elem.slab.cutFillBackgroundPen = (API_PenIndex)19; // Set override pen to 19
elem.wall.refMat = APINullValue; // Turn off
elem.wall.refMat = ACAPI_CreateAttributeIndex (100);
Hope that helps!
Bernd
Edit (2023-10-26): Fixed incorrect values/types as discussed below.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-10-25 03:59 PM
Awesome Bernd.. you've done it again.
I don't know how I missed this..
but also setting the mask helps 😂
Thanks, once again mate.👍

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-10-26 08:10 AM
Actually, the correct code is quite different. You can't use APINULLGuid .. because cutFillBackgroundPen is a pen index - not a GUID..
There is a new boolean parameter ".hasValue" just set this to false.
My problem was I hadn't changed the MASK_SET to these new parameters and therefore it wasn't working..
ACAPI_ELEMENT_MASK_SET(mask, API_SlabType, cutFillBackgroundPen);
ACAPI_ELEMENT_MASK_SET(mask, API_SlabType, cutFillPen);
if (element.slab.cutFillBackgroundPen.hasValue) {
element.slab.cutFillBackgroundPen.hasValue = false;
element.slab.cutFillPen.hasValue = false;
}
Thanks for your help anyway Bernd 👍
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2023-10-26 08:53 AM
Yes APINULLGuid was a typo sorry! It's still possible to use APINullValue though. It should have the same effect as setting .hasValue = false.
Here's the corresponding code for APIOptional in AC27 headers:
void operator = (NullValueType nullOpt) {
static_assert (nullOpt == APINullValue, "Unsafe assignment! Use APINullValue to indicate the loss of valid stored value.");
hasValue = false;
}
Also I've just realized that I've written GS::Optional<API_PenType>. That's also wrong because it's APIOptional<API_PenType>. Sorry for mixing it all up 😅 I'll edit my answer above.
And good catch with the mask!