API generated sketch with dimensions tied to userParameter

API generated sketch with dimensions tied to userParameter

jaco.waes
Contributor Contributor
509 Views
1 Reply
Message 1 of 2

API generated sketch with dimensions tied to userParameter

jaco.waes
Contributor
Contributor

I know how to create a sketch using the api, and i know how to set and get userParameters.

 

But i do not find the way to tie the two together.

 

width_param = design.userParameters.itemByName('Width')
length_param = design.userParameters.itemByName('Length')

width = width_param.value
length = length_param.value

 

Lets say i want to create a new sketch with a rectangle and have the width and length tied to the userparameter ... 

 

When creating a Point3D 's with these width and length (which are doubles) there is no link to the userParameter.

 

I have also looked at sketchDimensions, that has a read-only 'parameter' which is what i need to set. ... but the setter of value takes in a double again ... ?

 

 

0 Likes
Accepted solutions (1)
510 Views
1 Reply
Reply (1)
Message 2 of 2

j4n.vokurka
Advocate
Advocate
Accepted solution

Hello,

after creating an entity using the parameter value, you have to add dimension constraint and make it dependent on that user parameter.

I came upon a thread here on forum that already has a functioning sample that tackles this issue. See here.