Try to do a Spring

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Try to do a Spring

Post by jmaustpc »

@ Bejant
I wonder if you had a copy paste issue, because Mario's script worked for me.

With Python white spaces are very important, I have found that on some browser O/S combinations, if you click on the wiki's select all link, it will add about 4 spaces to each line when you paste it into the new macro. To fix that you have to work out how many spaces have been added and delete that same number of spaces from every line. I have found that high lightijng the text of the macro in the wiki with the mouse and then using ordinary copy paste seems to not add the extra spaces....

I think the problems you guys are seeing is a Bejant said, probably self intersecting solid, try moving the profile to outside of the helix path...rather than being centred on it.

Also there is an update in OCE master that may or may not effect this, it seems to fix an issue I was having with angled (tapered) Part Extrusions.

Jim
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Try to do a Spring

Post by bejant »

Jim, I selected the macro text by swiping with the mouse, then Ctrl +C, and tried several times to make sure I selected all the text. Running the macro produces one line segment on the X-Y plane; when I used it before the revision it worked fine. I'll try again later today.
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: Try to do a Spring

Post by mario52 »

hi
I do not understand I just tested the macro and it works perfectly
and by making a small change can work on any spire of the spring
Spire_makeBSpline_01.png
Spire_makeBSpline_01.png (4.28 KiB) Viewed 1529 times
you can display the error data
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Try to do a Spring

Post by jmaustpc »

bejant wrote:Jim, I selected the macro text by swiping with the mouse, then Ctrl +C, and tried several times to make sure I selected all the text. Running the macro produces one line segment on the X-Y plane; when I used it before the revision it worked fine. I'll try again later today.
Did you click on "save" before running the macro?

here is the macro zipped up, if you unzip it you should be able to just open it in FreeCAD.
helix_variable.FCMacro.zip
(940 Bytes) Downloaded 56 times
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: Try to do a Spring

Post by mario52 »

hi jmaustpc
jmaustpc wrote:
bejant wrote:Jim, I selected the macro text by swiping with the mouse, then Ctrl +C, and tried several times to make sure I selected all the text. Running the macro produces one line segment on the X-Y plane; when I used it before the revision it worked fine. I'll try again later today.
it is this version that has problems bejant ( last 6/11/2014) zipped version here
Macro_truncated_spring.zip
(1022 Bytes) Downloaded 57 times
bejant wrote:Edit: Mario, will you post back and let me know what is wrong?
if you want a previous version of a page in the wiki or page in macro, do "Show History" and choose a date
si vous voulez une version précédente d'une page dans le wiki ou page de macro, faites "Afficher l'historique" et choisissez une date
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Try to do a Spring

Post by NormandC »

Mario's macro is running fine for me. I copied it from the Macro's page on the wiki. It generates a BSpline object.

A note, if I try to sweep a profile along the BSpline without checking "Frenet", FreeCAD immediately crashes with no warning.

Running FreeCAD through gdb, I get this message:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0x00007fff608cec21 in BRepFill_Sweep::BuildShell(BRepFill_TransitionStyle, int, int, TopTools_MapOfShape&, BRepFill_DataMapOfShapeHArray2OfShape&, double, double) () from /usr/lib/x86_64-linux-gnu/libTKBool.so.9
If I check "Frenet", the sweep succeeds, but it shows the same artifact Mario has on the first image here. This seems to be at each place the pitch of the helix changes.

OS: Ubuntu 14.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4171 (Git)
Branch: master
Hash: 82ed56a3a91607c2c7e622fcd83793b9283a6940
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.1
Attachments
TruncateSpring_Sweep.fcstd
(33 KiB) Downloaded 43 times
Last edited by NormandC on Sat Nov 08, 2014 3:10 pm, edited 1 time in total.
Reason: Attached sample file.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Try to do a Spring

Post by jmaustpc »

mario52 wrote:it is this version that has problems bejant ( last 6/11/2014) zipped version here
normandc wrote: I copied it from the Macro's page on the wiki.
Hi Guys
I copied it from the wiki Macro page as well.

Jim
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: Try to do a Spring

Post by mario52 »

hi
normandc wrote:Mario's macro is running fine for me. I copied it from the Macro's page on the wiki. It generates a BSpline object.

A note, if I try to sweep a profile along the BSpline without checking "Frenet", FreeCAD immediately crashes with no warning.
thank you all for testing my macro, I was not better than you, but jakob had a good result
viewtopic.php?f=3&t=8313&start=10#p68323
I can try to soften the angle of the connector
I have also some time this window

merci à tous pour tester ma macro , je n'ai pas mieux que vous mais jakob a eu un bon résultat viewtopic.php?f=3&t=8313&start=10#p68323
je peux essayer d'adoucir l'angle du raccord

j'ai aussi quelques fois cette fenêtre
Spire_error_00.png
Spire_error_00.png (24.07 KiB) Viewed 1463 times
jakob wrote:Thx, now we are close. Just adjust the scripts value to my own.
to change the values to your needs, change in this section

Code: Select all

#### Configuration 2 + 2 Spires ##############################################
lastSpire        = 0.0         # last Spire   (high spring)
penultimateSpire = pas / 2     # penultimateSpire
#                              # normal Spring
#                              # normal Spring
secondSpire      = pas / 2     # second Spire
firstSpire       = 4           # first spire  (low spring)
##############################################################################
Example
1: modify the values
replace ex:

lastSpire = 4.0 # last Spire (high spring)
penultimateSpire = 8.0 # penultimateSpire
# # normal Spring
# # normal Spring
secondSpire = 8.0 # second Spire
firstSpire = 4.0 # first spire (low spring)

I made a shema position of the page Macro_TruncateSpring

2: quit and save the macro
3: load the macro in FreeCAD
4: run the macro

mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: Try to do a Spring

Post by bejant »

jmaustpc wrote:Did you click on "save" before running the macro?
No, I pasted it into the python console.
jmaustpc wrote:here is the macro zipped up, if you unzip it you should be able to just open it in FreeCAD.
Unzipping it, saving to my macros folder, and running through here works:
Image
mario52 wrote:zipped version here
Macro_truncated_spring.zip
Unzipping into my macros folder ad running it the same way as above works fine too.

I'll run the macros that way instead of pasting into the python console...
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: Try to do a Spring

Post by mario52 »

hi
nice
I prepare the final version with GUI
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
Post Reply