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: 

Get CAM parameter value on a text box

3 REPLIES 3
Reply
Message 1 of 4
pedro_babo2
188 Views, 3 Replies

Get CAM parameter value on a text box

Im triyng to get the value one CAM parameter on a command input.

 

using 

 

        DiametroPeça =setup.parameters.itemByName('job_stockDiameter')
        ComprmentPeça = '100'
   
    # Create a simple text box input.
    inputs.addTextBoxCommandInput('Diametro', 'Diametro da Peça', DiametroPeça.value.objectType, 1, True)
    inputs.addTextBoxCommandInput('Comprimento', 'comprimento da Peça', ComprmentPeça, 1, True)
 
----
I get 
 
<adsk.cam.CAMParameter; proxy of <Swig Object of type 'adsk::core::Ptr< adsk::cam::CAMParameter > *' at 0x000002294ACD6C70> >
 
how should I get the correct value.
3 REPLIES 3
Message 2 of 4
BrianEkins
in reply to: pedro_babo2

I think this should do it. The value returned is a floating point value and is always in centimeters. You can convert it yourself to the unit of choice or use Fusion's Units of Measure functionality to help convert and format it. You might also consider using a ValueCommandInput instead of a TextBoxCommandInput because it will handle this automatically.

 

DiametroPeça = setup.parameters.itemByName('job_stockDiameter')
paramValue = DiametroPeça.value.value

# Create a simple text box input.
inputs.addTextBoxCommandInput('Diametro', 
                              'Diametro da Peça', 
                              f'{paramValue} cm', 
                              1, 
                              True)

  

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 4
pedro_babo2
in reply to: BrianEkins

hi @BrianEkins ,

 

first thanks for the responce, I've ben beasy during the this time.

Ive implemented the code has you sogested but get

 

"Diametro da Peça nan cm" 

 

on the form.

I sopose that nan is not a number. possibly a string.

 

what does f'{paramValue} do?

Message 4 of 4
jeff.pek
in reply to: pedro_babo2

Hi -

 

Not sure if this helps, but the "job_stockDiameter" parameter will only be valid for "Fixed Cylinder" and "Fixed Tube" stock types. What is your setup using?

 

Jeff

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