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

adding unitless user parameter with API

pludikar
Collaborator

adding unitless user parameter with API

pludikar
Collaborator
Collaborator

Hi,

in the standard UI, when you add a user parameter, there's a drop down for units.  At the top of the list is "No Units" - with this option you can create a unitless parameter, and it works.

 

no Units dialog Fusion 360.png

 

Unless I'm missing something, there doesn't seem to be a way to create a unitless parameter in the API.  

 

 

userParams = self.design.userParameters

dValIn = adsk.core.ValueInput.createByReal(10.0)

dParameter = userParams.add('unitLessParameter',dValIn, self.design.unitsManager.defaultLengthUnits, '')

unitsManager doesn't seem to have the "no Units" option.  Am I missing something,  or is this an oversight in the API?

 

Regards

Peter

 

 

I'm not an expert, but I know enough to be very, very dangerous.

Life long R&D Engineer (retired after 30+ years in Military Communications, Aerospace Robotics and Transport Automation).
0 Likes
Reply
Accepted solutions (1)
592 Views
2 Replies
Replies (2)

MichaelT_123
Advisor
Advisor
Accepted solution

Hi Peter,

 

try:

paramUnit = ''

 

userParams.add(paramName, paramValue, paramUnit, paramComment)

 

Regards

MichaelT

MichaelT
0 Likes

pludikar
Collaborator
Collaborator

@MichaelT_123

D’oh. I tried that before I posted, but I was getting an error.  Anyway, tried it again today, and it works.  Thanks. 

 

I must have been tired and/or frustrated.  I usually manage to work these simple things out on my own.

 

peter

I'm not an expert, but I know enough to be very, very dangerous.

Life long R&D Engineer (retired after 30+ years in Military Communications, Aerospace Robotics and Transport Automation).
0 Likes