Hi there,
I am looking for a way to define and use constants for a model.
In a model all the drill hole have a radius of 3mm. And there several of hole.
How to define a constant for the model? And how to use a defined constant in a sketch?
Is there also the possibility to change this radius later on to an other radius?
Has anbody an idea? I'am realy new to FreeCad.
Define Constant
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Define Constant
Hi!
Use spreadsheet.
Use spreadsheet.
Re: Define Constant
Hello Konni,
Welcome to FreeCAD and the forum.
If your holes are all in the same sketch, you can apply an equality constraint between all circles, and add a radius constraint to a single circle.
Another method is the following: let's say you've added a sketch with circles, then created a pocket feature on your part. You now apply a new sketch on the face of your pocket feature, to create a new set of holes. You can use the External Geometry tool to link the edge of one of the existing holes, and apply an equality constraint between it and the circles in your sketch.
One more thing: are your holes set in a regular pattern (linear or radial)? Then it will be quicker to sketch and pocket a single one, then create a transformation feature like Linear Pattern, Polar Pattern or MultiTransform.
Don't hesitate to ask questions, but please also post your FreeCAD info as detailed in the link from that big red banner at the top, you can't possibly miss it (yet you apparently did). That way we can be sure you have the latest version available.
Welcome to FreeCAD and the forum.
If your holes are all in the same sketch, you can apply an equality constraint between all circles, and add a radius constraint to a single circle.
Another method is the following: let's say you've added a sketch with circles, then created a pocket feature on your part. You now apply a new sketch on the face of your pocket feature, to create a new set of holes. You can use the External Geometry tool to link the edge of one of the existing holes, and apply an equality constraint between it and the circles in your sketch.
One more thing: are your holes set in a regular pattern (linear or radial)? Then it will be quicker to sketch and pocket a single one, then create a transformation feature like Linear Pattern, Polar Pattern or MultiTransform.
Of course. If it's defined by a radius constraint in a sketch, just edit the sketch then change the value of the radius constraint. If defined in a Spreadsheet as suggested by DeepSOIC, just change the value in the spreadsheet. See Spreadsheet Workbench for more info.Konni wrote:Is there also the possibility to change this radius later on to an other radius?
Don't hesitate to ask questions, but please also post your FreeCAD info as detailed in the link from that big red banner at the top, you can't possibly miss it (yet you apparently did). That way we can be sure you have the latest version available.
Re: Define Constant
Thanks for your answers.
Here is the info of my version:
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6703 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: 2ce5c8d2e3020d05005ed71f710e09e9aa561f40
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Realy interessting is what DeepSOIC said:
In the tutorial it is only said, how to do calulation and stuff like this.
But there is no hint how to reference cell values in a sketch.
If I make a circle in a sketch and make a radius constraint. Can I write something like:
That was my first though. But all your values in a spreadsheet and use them in a sketch. But I do not know how.
Here is the info of my version:
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6703 (Git)
Build type: Release
Branch: releases/FreeCAD-0-16
Hash: 2ce5c8d2e3020d05005ed71f710e09e9aa561f40
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Realy interessting is what DeepSOIC said:
But how?Use spreadsheet
In the tutorial it is only said, how to do calulation and stuff like this.
But there is no hint how to reference cell values in a sketch.
If I make a circle in a sketch and make a radius constraint. Can I write something like:
,like I would do in Excel?SpreadscheetName.A2
That was my first though. But all your values in a spreadsheet and use them in a sketch. But I do not know how.
Re: Define Constant
I was sure it was documented in the Spreadsheet Workbench wiki page, or the Expressions page, but it does not look to be the case.Konni wrote:But there is no hint how to reference cell values in a sketch.
I attached a simple example with a sketch and a spreadsheet. Steps to recreate:
- Create sketch, draw a rectangle, you can constrain it now or later
- Swith to the Spreadsheet workbench, create a spreadsheet
- Double click on the Spreadsheet object in the Model tree to open it
- Select a cell, then create an alias for it by clicking on the tool in the toolbar. AFAIK it's the only way to use a cell content with the Expressions engine. Actually this step is unnecessary, using the cell ID like "A4" works. You can also right-click on a cell, select Properties, and go to the "Alias" tab. Once a cell has an alias, its background turns to yellow. Enter a numerical value in the cell.
- Repeat with a second cell.
- Edit the sketch.
- Add a horizontal distance constraint to the rectangle. When the dialog pops up to set the numerical value, click on the blue Expressions icon f(x) at the right of the field.
- Type in Spreadsheet.Name, where "Name" is the alias of the cell you want to link. In the attached file, I created two aliases, "Length" and "Width".
- Click OK to close the Expressions dialog, then OK again to close the "Insert length" dialog.
- Close the sketch and change the cell values in the spreadsheet. The sketch will automatically update.
- Attachments
-
- sketch & spreadsheet example_normandc1.fcstd
- (6.52 KiB) Downloaded 75 times
Re: Define Constant
Thank you very much.
That is what I was looking for.
FreeCad is a very good tool.
That is what I was looking for.
FreeCad is a very good tool.