Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Is there any difference between moving a component via UI and creating a component via Api and transformation matrix?

-pezi-
Enthusiast

Is there any difference between moving a component via UI and creating a component via Api and transformation matrix?

-pezi-
Enthusiast
Enthusiast

Our procedure:

  1. Determination of the insertion point (insertPoint)
  2. Gets the translation component of the matrix

 

Ptr<Matrix3D> matrix3d = Matrix3D::create();
matrix3d->translation(Point3D::create(0, 0, 0)->vectorTo(insertPoint));

 

     

  1. Basing the component on the transformed matrix

 

Ptr<Occurrence> occ = root->occurrences()->addNewComponent(matrix3d);

 

  1. In this component I will create BRepBody and design planes. Then I select a construction plane, create a sketch on it and project the selected surface onto it, see figure

pezi_0-1667386413034.png

 

Etruding the resulting profile creates a new BRepBody, but it is displaced, see next figure.

pezi_1-1667386413046.png

 

 

This procedure worked correctly in our application until recently.

 

However, if I create a BRepBody at the origin of the document and apply the COPY/MOVE with Point to Point

pezi_2-1667386413060.png

 

and then use the same API code, everything goes fine

pezi_3-1667386413073.png

 

pezi_4-1667386413083.png

 

 

So the question is, what has changed? And is the fault on our side or Autodesk's?

0 Likes
Reply
254 Views
3 Replies
Replies (3)

BrianEkins
Mentor
Mentor

This problem was recently reported by someone else, and Autodesk has acknowledged it is a bug. I expect it will be fixed soon.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes

BrianEkins
Mentor
Mentor

Which API method are you using to do the projection? The known problem is with Sketch.project.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes

-pezi-
Enthusiast
Enthusiast

Hi Brian,

thanks for you asnwer. Bellow is main part of code which I used for tested on figures in my first post.

	Ptr<SelectionCommandInput> selectionInput = inputs->itemById("constructionPlanes");
	if (selectionInput->selectionCount() < 1)
		return;
	Ptr<ConstructionPlane> constrPlane = selectionInput->selection(0)->entity();
	if (!constrPlane)
		return;
	Ptr<SelectionCommandInput> selectFace = inputs->itemById("selFace");
	if (selectFace->selectionCount() < 1)
		return;
	Ptr<BRepFace> face = selectFace->selection(0)->entity();
	if (!face)
		return;

	Ptr<Sketch> newSketch = constrPlane->component()->sketches()->add(constrPlane);
	newSketch->isVisible(false);

	double thicknessPanel = 1.8;

	Ptr<Profile> profile = constrPlane->component()->createOpenProfile(newSketch->project(face), false);

	Ptr<Profiles> profs = newSketch->profiles();
	if (!profs)
		return;
	Ptr<Profile> prof = profs->item(0);
	if (!prof)
		return;

	Ptr<ExtrudeFeature>	extrude = constrPlane->component()->features()->
		extrudeFeatures()->addSimple(prof, ValueInput::createByReal(thicknessPanel), FeatureOperations::NewBodyFeatureOperation);​
0 Likes