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: 225
Joined: Fri Apr 26, 2019 3:14 pm

Named Objects and their properties?

Post by C_h_o_p_i_n »

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
Veteran
Posts: 4163
Joined: Wed Nov 21, 2018 1:13 pm

Re: Named Objects and their properties?

Post by kisolre »

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: 225
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Post by C_h_o_p_i_n »

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
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: Named Objects and their properties?

Post by chrisb »

Give a name to the blue reference constraint in the elements list.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
C_h_o_p_i_n
Posts: 225
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Post by C_h_o_p_i_n »

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
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Named Objects and their properties?

Post by DeepSOIC »

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: 225
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Post by C_h_o_p_i_n »

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
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Named Objects and their properties?

Post by DeepSOIC »

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: 225
Joined: Fri Apr 26, 2019 3:14 pm

Re: Named Objects and their properties?

Post by C_h_o_p_i_n »

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
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Named Objects and their properties?

Post by DeepSOIC »

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.
Post Reply