Named Objects and their properties?

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
C_h_o_p_i_n
Posts: 49
Joined: Fri Apr 26, 2019 3:14 pm

Named Objects and their properties?

Postby C_h_o_p_i_n » Fri Aug 23, 2019 8:20 am

Hello,

While using Part Design w/ Sktecher I was wondering how to access any properties of used primitives - e.g. the length of an vertext to use it as input into an expression in any subsequent sketches.

I know that i may access (and name) constraints - but sometimes e.g. a length of a certain vertex results due to other constraints. Adding another constraint to e.g. access its lentgh leads to an overdetermined sketch.

So - helpful would be a possibility to access "named/labeld" Properties - or - having the properties of "passive constraints" - well - rather ... results in any wa accesible.

This might also facilitate the use of "external geometry" explicit ( in expressions ).

Regards,
Stefan
kisolre
Posts: 1360
Joined: Wed Nov 21, 2018 1:13 pm

Re: Named Objects and their properties?

Postby kisolre » Fri Aug 23, 2019 9:39 am

You have reference/driven dimensions for that purpose. There is an icon at the end of the toolbar that changes icons to blue.
C_h_o_p_i_n
Posts: 49
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Postby C_h_o_p_i_n » Fri Aug 23, 2019 10:57 am

Hi,
kisolre wrote:
Fri Aug 23, 2019 9:39 am
You have reference/driven dimensions for that purpose. There is an icon at the end of the toolbar that changes icons to blue.
I'm aware of the "blue" construction elements - but you can't access "dervied" dimension to use them in subsequent sketches.
You can use the e.g. length definded in any (blue/red) constraint - but - according to my actual knoledge - no derived dimensions.

If you try to add a constraint to name/lable your "derived" vertex you get an overdetermined warning.

Think of a triangel where's given a,b and the angle between a,b - you like to use the length of c in a subsequent sketch as part of an expression.
How to access "c" ?

Regards, Stefan
chrisb
Posts: 18991
Joined: Tue Mar 17, 2015 9:14 am

Re: Named Objects and their properties?

Postby chrisb » Fri Aug 23, 2019 12:00 pm

Give a name to the blue reference constraint in the elements list.
C_h_o_p_i_n
Posts: 49
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Postby C_h_o_p_i_n » Fri Aug 23, 2019 12:19 pm

Hi Chris,

we'd talked already in the german forum about this topic and I'd gave it a try.

it's no problem to give a constraint a name - but also with the constuction-type constraints i always got a "overdetermined" warning whenever I tryed to put a constraint onto a vertex which is defined due to other constraints ... ( klicking cancel is th only thing which you could do )

Regards, Stefan
User avatar
DeepSOIC
Posts: 7057
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Named Objects and their properties?

Postby DeepSOIC » Fri Aug 23, 2019 12:25 pm

Rename the blue constraint from context menu in constraint list.

Note that you won't be able to reference the value of the blue constraint in an expression for another constraint in that same sketch. You can do it only across sketches.
C_h_o_p_i_n
Posts: 49
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Postby C_h_o_p_i_n » Fri Aug 23, 2019 12:30 pm

DeepSOIC wrote:
Fri Aug 23, 2019 12:25 pm
Rename the blue constraint from context menu in constraint list.

Note that you won't be able to reference the value of the blue constraint in an expression for another constraint in that same sketch. You can do it only across sketches.
Hej,

this is also known. the problem is - that I can't overcom the "overdetermined" Warning. When the length I'm trying to retrieve is defined due to other constraints.

Think of a triangel where's given a,b and the angle between a,b - you like to use the length of c in a subsequent sketch as part of an expression.
How to access the length of "c" ?

Regards, Stefan
User avatar
DeepSOIC
Posts: 7057
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Named Objects and their properties?

Postby DeepSOIC » Fri Aug 23, 2019 12:46 pm

I tought my answer was enough. Apparently, not really. Let me elaborate:
1. Draw your triangle, and constrain it.
2. click "Toggle reference/driving constraint" button on constraints toolbar.
->Constraint icons on the toolbar should turn blue.
3. Select the edge you want to measure, apply length constraint.
->The constraint should just appear, you won't get the regular length prompt.
4. Right-click the constraint in constraint list (in task dialog, on the left usually), pick "rename", type the name (e.g. "c"), hit enter.
5. Close the sketch. Now you can refer to that blue constraint value in expressions as Sketch.Constraints.c
C_h_o_p_i_n
Posts: 49
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Postby C_h_o_p_i_n » Fri Aug 23, 2019 3:52 pm

DeepSOIC wrote:
Fri Aug 23, 2019 12:46 pm
I tought my answer was enough. Apparently, not really. Let me elaborate:
1. Draw your triangle, and constrain it.
2. click "Toggle reference/driving constraint" button on constraints toolbar.
->Constraint icons on the toolbar should turn blue.
3. Select the edge you want to measure, apply length constraint.
->The constraint should just appear, you won't get the regular length prompt.
4. Right-click the constraint in constraint list (in task dialog, on the left usually), pick "rename", type the name (e.g. "c"), hit enter.
5. Close the sketch. Now you can refer to that blue constraint value in expressions as Sketch.Constraints.c
Thanks a lot - I must have previously done something - well - very wrong - using your step-by-step description it works like a charm.
I Think I tried to constrain a (blue) construcion line using a regular /driving constraint.

Is there a way to retrieve the arc length of a circle / or the lenght of a part of a circle too (wihtout calculating it using angle, pi and diameter ) ?

Regards, Stefan
User avatar
DeepSOIC
Posts: 7057
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Named Objects and their properties?

Postby DeepSOIC » Fri Aug 23, 2019 4:09 pm

C_h_o_p_i_n wrote:
Fri Aug 23, 2019 3:52 pm
Is there a way to retrieve the arc length of a circle / or the lenght of a part of a circle too (wihtout calculating it using angle, pi and diameter ) ?
Not with a blue constraint. But you can refer to it as Sketch.Shape.Edge56.Length (replace 56 with the right number), as long as the edge is not a construction edge. This method is of course prone to referring to a wrong edge if you change the sketch.