Update cutomgraphics text size by slider input value (addFloatSliderCommandInput)

Update cutomgraphics text size by slider input value (addFloatSliderCommandInput)

shubham.shinde54DT9
Contributor Contributor
1,026 Views
4 Replies
Message 1 of 5

Update cutomgraphics text size by slider input value (addFloatSliderCommandInput)

shubham.shinde54DT9
Contributor
Contributor

Hi @BrianEkins  @boopathi.sivakumar  @chris.monachanZWSCF 

We are trying to update the size of custom graphics text by slider input value. We have made UI for that. The size gets updated as we move the slider but it returns to its original size after leaving the slider. If we do not use the UI then size gets updated with the hard code given value .

 

Please refer to below GIF for more details.

Update text size.gif

We have used below code to update custom graphics text.

Model Scale code:
Ptr<BoundingBox3D> bbox = cgEnt->boundingBox();
Ptr<Point3D> maxPt = bbox->maxPoint();
Ptr<Point3D> minPt = bbox->minPoint();
_scaleFactor = 100 / minPt->distanceTo(maxPt);
Ptr<CustomGraphicsText> graphicsText = cgEnt->cast<CustomGraphicsText>();
bool result = graphicsText->size(_scaleFactor);

 

As per below code, it is possible to view scale custom graphic entity by slider input value.
View Scale code:
Ptr<BoundingBox3D> bbox = cgEnt->boundingBox();
Ptr<Point3D> maxPt = bbox->maxPoint();
Ptr<Point3D> minPt = bbox->minPoint();
_scaleFactor = 100 / minPt->distanceTo(maxPt);
Ptr<CustomGraphicsViewScale> attr = CustomGraphicsViewScale::create(_scaleFactor * _pixelScale->valueOne(), _anchorPt);
cgEnt->viewScale(attr);

 

Is there any solution for this?

 

Thanks in advance

 

Please refer video attachments for more details.

 

 

0 Likes
Accepted solutions (1)
1,027 Views
4 Replies
Replies (4)
Message 2 of 5

kandennti
Mentor
Mentor

Hi @shubham.shinde54DT9 .

 

I've never tried it, so I don't know the details, but is it handled by the inputChanged event?

0 Likes
Message 3 of 5

shubham.shinde54DT9
Contributor
Contributor

Yes We have handled it by input changed event.

0 Likes
Message 4 of 5

BrianEkins
Mentor
Mentor
Accepted solution

Attached is a sample command that demonstrates modifying the size of the text using a slider as expected.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 5 of 5

shubham.shinde54DT9
Contributor
Contributor

Thanks @BrianEkins  . It is working fine now

0 Likes