Macro FCSpring Helix Variable

From FreeCAD Documentation
Jump to: navigation, search
Other languages:
English • ‎français • ‎hrvatski • ‎italiano

FCSpring Helix Variable.png Macro FCSpring Helix Variable

Description
Creates a spring with helix variable.
Version 01.13 Date 2019/04/08. Download the Icons in .zip file
Author
Mario52
Links
Macros recipes
How to install macros
How to customize toolbars
Version
01.13
Date last modification
2019-04-08
Default shortcut
None
See also
None


Description

This macro creates a spring with customizable, any turn may change the spring configuration can be saved in a file with the extension .FCSpring

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon_Installer.


##This code is copied instead of the original macro code

##to guide the user to the offline download page

##Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki

##or if the RAW code url is extra wiki location

import PySide

from PySide import QtGui ,QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,u"Information",
    "This macro must by downloaded with this link" + "\n"
    " " + "\n"
    "https://gist.githubusercontent.com/mario52a/68c81c32a0727a693d3a/raw/4093f7e3b7f4d52dcfa923cf912de59beab4bdc6/Macro_FCSpring_Helix_Variable.FCMacro" + "\n"
    " " + "\n"
    "Quit this window for access in the download page" )

diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)

diag.setWindowModality(QtCore.Qt.ApplicationModal)

diag.exec_()

import webbrowser 

webbrowser.open("https://gist.githubusercontent.com/mario52a/68c81c32a0727a693d3a/raw/4093f7e3b7f4d52dcfa923cf912de59beab4bdc6/Macro_FCSpring_Helix_Variable.FCMacro")
<class="rawcodeurl"><a href="https://gist.githubusercontent.com/mario52a/68c81c32a0727a693d3a/raw/4093f7e3b7f4d52dcfa923cf912de59beab4bdc6/Macro_FCSpring_Helix_Variable.FCMacro">raw code</a>


TruncateSpring00.png

FCSpring Helix Variable


Use

This section is used to configuration the spring

Schematic detail of spring configuration

Macro TruncateSpring 01.png

Gui

Macro FCSpring Helix Variable 01.png

First section, spring configuration

  • Number of coil : Total of coil to spring. Default = 10
  • Radius of spring : Radius of spring. Default = 20.0
  • Pitch of spring : Pitch of spring general. Default = 15.0
  • Precision of turn : Precision of turn the precision correspond the number of point for 1 turn the coil and is calculate : precision (number points) = (pitch / (360/precision)). Default = 5 (72 points)
  • Spring conical : Give the large diameter of the cone that dimension will always be greater than the radius
  • Begin : Begin angle of the spring first coil.
  • End : End angle of the spring last coil.
  • Ch. : Check box choice for activate the function Begin and End angle of the coil unchecked by default.
    If the function is checked The accuracy is automatically set to 1 (360 points per turn 1 point = 1 degrees)

Macro FCSpring Helix Variable 02.png

Second section, type line

  • BSpline : Type line BSpline.
  • Wire : Type line Wire.
  • Points : Check box point if the check box is activate one point is create of on each point.
  • Reverse : Check box reverse if the check box is activate the spring changes direction

Macro FCSpring Helix Variable 03.png

Third section, selection

This section is displayed if on object is selected. The type object is displayed in the Text Editor

The object can be line, 2 points, circle, wire ... one axis the length of the spring is automatically created

Detection : Cylinder (radius), Sphere (radius), Toroid (radius) , Cone (little radius), Circle (radius), Arc (radius), Ellipse (little radius)

  • Norm. : If one circle is selected Norm not modify the radius of circle (Default)
    • AdpRa : If the buttom is pressed, the spring is adapted to the detected radius (If a radius is detected )
  • PMous : If the clic mouse is on one face the spring is createt on this point (Default)
    • CFace : If the buttom is pressed, the spring is created on the center face selected
  • Position : If twoo object are selected (first axis, second spring), this checkBox is enabled and you can modify the placement object 2 (spring) along the on object 1 (axis)
  • Circle : If three points click mouse are selected the Circle button is enabled and it possible to create a circle which can serve as a base for a spring
  • ... :

Position (0)(xx)

(0)(xx) : Number selection(s), length in mm of axis created x 10, egual number of points for shifting the spring of the axis

  • Begin/End : Position the spring on begin, middle, end axis
  • RSpr : Reverse the spring of the axis
  • DoubleSpinBox : Shifting the spring with precision (0.1 mm) along its axis
  • RCom : Reverse the counter ex: Begin 0 to 10.. or End 0 to 10..
  • Slider : Position the spring on its axis

Macro FCSpring Helix Variable 02 2.png

Four section, coil special length

  • Numbering of coil : Numbering of coil to modify. (Defaut : none)
  • Smoothing This checkBox discover one spinBox for determine the grade of smoothing the maximum value is the precision value -1 (this option is still at the prototype stage and the result can be satisfying or completely wrong)
  • Pitch of coil : Pitch of coil to modify. (Defaut : none)
  • 15 : If the button is pressed the value of the "Pitch of string" is affected of the "Pitch of coil" (This value is automatically aligned of the value Pitch of string)
  • Radius of coil : Radius of coil to modify. (Defaut : none)
  • 20 : If the button is pressed the value of the "Radius of string" is affected of the "Radius of coil" (This value is automatically aligned of the value Radius of string)
  • Accept the value modified : Button to accept the modification after select the numbering of coil and modify the pitch of coil.
  • Text edit : This window displayed all coil modified.
  • C : Clean the text editor
  • Z : Button "Zoom" enlarge the textedit window

Macro FCSpring Helix Variable 04.png

Commands

  • Load : The Read button open a dialogue box to read a file .FCSpring.
  • Save : The Save button open a dialogue box to save a file .FCSpring with configuration spring modify or not.
  • Load Coordinates : Open a dialogue box to read a file .FCSpringCoor (all coordinates of points of the spring).
  • Save Coordinates : Open a dialogue box to save a file .FCSpringCoor (all coordinates of points of the spring).
  • Quit : Quit the macro.
  • Reset : Reset the macro to default configuration.
  • Launch : Launch the macro and create the spring configured.

Macro FCSpring Helix Variable 05.png

Report view

The window report view displayed all value modified.

Macro FCSpring Helix Variable 06.png

Example spring

Example to spring modified

Macro FCSpring Helix Variable 07.png

Example Report view

When the macro is launched full list of turns is displayed in tabular form.

Here the data of the spring above and displayed in the Report view Macro FCSpring Helix Variable 08.png

Icon

Download the file image and copy in your macro repertory.

Click the image, in the new window position the mouse over the image, click the right mouse and do "Save target as ..."

ToolBar button
Button

Macro icons

FCSpring Helix Variable Icon 01.png FCSpring Helix Variable Icon 02.png FCSpring Helix Variable Icon 02b.png FCSpring Helix Variable Icon 03.png FCSpring Helix Variable Icon 03b.png FCSpring Helix Variable Icon 04.png FCSpring Helix Variable Icon 05.png FCSpring Helix Variable Icon 06.png

Script

Macro_FCSpring_Helix_Variable.FCMacro

Download the macro to Gist Macro_FCSpring_Helix_Variable

Installation

The above file is a macro in the form of GitHub code. Download the Zip on GitHub, and then follow the macros installation instructions for dummies shown at installing FreeCAD macros in Ubuntu.

Examples









Links

The forum discussion Try to do a Spring

Project

spring solid truncated

soften fittings :done

modify diameter to any coil :done

Version

2019/04/08 Ver 01.13: compatible FreeCAD 0.18.16093 (Git) /Python version: 3.6.6 /Qt version: 5.6.2

03/04/2017: ver 01.12: correction bug line 2314 add "global ui"

11/12/2016: ver 01.11: Adding Position of the spring on a selected object

10/09/2016: ver 01.10: Adding Button "Zoom" enlarge the textedit window

04/09/2016: ver 01.09: add smoothing

16/03/2016: ver 01.08 : correct and add "int()" to debutAngle and finAngle (read file)

02/03/2016: ver 01.07 : add option reverse spring

08/02/2016: ver 01.06 : correct bug angle cause "modifyAngle = int(file.readline().rstrip('\n\r')) # 9" modifyAngle is int() not char

07/01/2015: ver 01.05 : adding "Try ...Except" (data cone) for compatibility with old version

07/01/2015: ver 01.04 : adding spring conical and modify the path to "UserAppData" and adding the icone.

07/12/2014: ver 01.03 : new version with radius coil adjustable

17/11/2014: ver 1.02 : new version with GUI and modification any coil and save or load the data to disk.

10/11/2014: (23h20) correction of the modification

ligne.Placement = App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(0,0,1),angleTr), App.Vector(0,0,0))

10/11/2014: modify line 44 :

a = FreeCAD.ActiveDocument.Line.Placement=App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(0,0,1),angleTr), App.Vector(0,0,0))

to

ligne = FreeCAD.ActiveDocument.Line.Placement=App.Placement(App.Vector(0.0,0.0,0.0), App.Rotation(App.Vector(0,0,1),angleTr), App.Vector(0,0,0))

6/11/2014 : adding "makeBSpline" and configuration

Limitations

During sweep tests here are the mistakes I have obtained !