Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Extrude NegativeExtentDirection stopped working

3 REPLIES 3
Reply
Message 1 of 4
rolandas.vegis
440 Views, 3 Replies

Extrude NegativeExtentDirection stopped working

Hello,

 

After the last update it seems that specifying NegativeExtentDirection when creating extrude does not work correctly. It goes in the positive direction anyway.

 

Demo code showing the issue.

Both extrudes are created in the exactly same place, negative one should go in the opposite direction.

 

#include <Core/CoreAll.h>
#include <Fusion/FusionAll.h>
#include <CAM/CAMAll.h>

using namespace adsk::core;
using namespace adsk::fusion;
using namespace adsk::cam;

Ptr<Application> app;
Ptr<UserInterface> ui;

extern "C" XI_EXPORT bool run(const char* context)
{
	app = Application::get();
	ui = app->userInterface();

	const auto selections = ui->activeSelections();
	if (selections->count() == 0)
		return true;

	const Ptr<BRepFace> face = selections->item(0)->entity();
	if (!face)
		return true;

	const auto extrudeFeatures = face->body()->parentComponent()->features()->extrudeFeatures();
	
	const auto input = extrudeFeatures->createInput(face, NewBodyFeatureOperation);
	const auto distanceExtent = DistanceExtentDefinition::create(ValueInput::createByReal(2));
	input->setOneSideExtent(distanceExtent, NegativeExtentDirection);
	extrudeFeatures->add(input);

	input->setOneSideExtent(distanceExtent, PositiveExtentDirection);
	extrudeFeatures->add(input);

	return true;
}

extern "C" XI_EXPORT bool stop(const char* context)
{
	return true;
}

 While specifying negative thickness is a possible workaround, that would require an add-in update.

3 REPLIES 3
Message 2 of 4
goyals
in reply to: rolandas.vegis

I am able to see the problem and will do more investiggation on our side. Created FUS-77544 ticket to track it. Thanks for reporting this issue. 



Shyam Goyal
Sr. Software Dev. Manager
Message 3 of 4
KrisKaplan
in reply to: rolandas.vegis

FWIW: Until this is fixed, there is a fairly simple workaround. Just as in the interactive Extrude command, there isn't really a 'positive/negative' flip direction state. To extrude in the negative distance, it really just uses a negative direction. So you can create a negative extent extrude by just using PositiveExtentDirection and a negative value, e.g. ValueInput.createByReal(-2).

 

Kris



Kris Kaplan
Message 4 of 4

I have the same error. It breaks some of my add-ins.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report