Macro Ellipse-Center+2Points/cs: Difference between revisions

From FreeCAD Documentation
(Created page with "==Најновији==")
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 6: Line 6:
|Description=Vytvoří elipsu výběrem 3 bodů (v tomto pořadí): střed, velký poloměr, malý poloměr
|Description=Vytvoří elipsu výběrem 3 bodů (v tomto pořadí): střed, velký poloměr, malý poloměr
|Author=Eriossoltero
|Author=Eriossoltero
|Version=01.00
|Version=02.00
|Date=2016-12-25
|Date=2019-07-29
|FCVersion=All
|FCVersion=All
|Download=[https://www.freecadweb.org/wiki/images/6/66/Macro_Ellipse-Center%2B2Points.png ToolBar Icon]
|Download=[https://www.freecadweb.org/wiki/images/6/66/Macro_Ellipse-Center%2B2Points.png ToolBar Icon]
Line 19: Line 19:
==Најновији==
==Најновији==


<div class="mw-translate-fuzzy">
The latest version of the macro is to be found at [https://github.com/FreeCAD/FreeCAD-macros/blob/master/ObjectCreation/EllipseCenter2Points.FCMacro EllipseCenter2Points.FCMacro] but the easiest way to install this macro is through the [[Addon Manager]].
Најновија верзија макроа налази се на адреси [https://github.com/FreeCAD/FreeCAD-macros/blob/master/ObjectCreation/EllipseCenter2Points.FCMacro EllipseCenter2Points.FCMacro] али најлакши начин да инсталирате овај макро је преко[[Std_AddonMgr/cs|Аддон Манагер]].
</div>


==Skript==
==Сцрипт==

ToolBar Icon [[Image:Macro_Ellipse-Center%2B2Points.png]]


'''Macro_EllipseCenter2Points.FCMacro'''
'''Macro_EllipseCenter2Points.FCMacro'''


{{Code|code=
{{MacroCode|code=



# Macro Begin: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
# https://www.freecadweb.org/wiki/User:Eriossoltero
# 13/03/2012, 29/07/2019
import Part, FreeCAD, math, PartGui, FreeCADGui
from FreeCAD import Base

# get the selected objects, with first selection for the trajectory and second for the section
# Adapted from:
# Macro Begin: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++
# Macro Begin: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
Line 37: Line 51:
s = FreeCADGui.Selection.getSelection()
s = FreeCADGui.Selection.getSelection()
try:
try:
sel1=s[0].Shape
sel1=s[0].Shape
sel2=s[1].Shape
sel2=s[1].Shape
sel3=s[2].Shape
sel3=s[2].Shape
pt_center = sel1.Point
except:
pt_radmay = sel2.Point
print "Wrong selection"
pt_radmen = sel3.Point
# create Part object in the current document
myObject=App.ActiveDocument.addObject("Part::Feature","Ellipse")
# create a shape and assign it to the current document
ellipse = Part.Ellipse(pt_radmay, pt_radmen, pt_center)
myObject.Shape = ellipse.toShape()
# Macro End: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++


except:
pt_center = sel1.Point
print( "Wrong selection")
pt_radmay = sel2.Point
print( "First:centre, Second:major radius and Third:minor radius")
pt_radmen = sel3.Point

# create Part object in the current document
myObject=App.ActiveDocument.addObject("Part::Feature","Ellipse")


# create a shape and assign it to the current document
ellipse = Part.Ellipse(pt_radmay, pt_radmen, pt_center)
myObject.Shape = ellipse.toShape()
# Macro End: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++
}}
}}



Latest revision as of 20:20, 3 November 2021

Other languages:

Ellipse Center+2Points

Popis
Vytvoří elipsu výběrem 3 bodů (v tomto pořadí): střed, velký poloměr, malý poloměr

Version macro : 02.00
Date last modification : 2019-07-29
FreeCAD version : All
Download : ToolBar Icon
Autor: Eriossoltero
Autor
Eriossoltero
Download
ToolBar Icon
Odkazy
Verze
02.00
Datum poslední úpravy
2019-07-29
Verze FreeCAD
All
Výchozí zástupce
None
Viz též
None

Popis

Vytvoří elipsu výběrem 3 bodů (v tomto pořadí): střed, velký poloměr, malý poloměr

Најновији

Најновија верзија макроа налази се на адреси EllipseCenter2Points.FCMacro али најлакши начин да инсталирате овај макро је прекоАддон Манагер.

Сцрипт

ToolBar Icon

Macro_EllipseCenter2Points.FCMacro

# Macro Begin: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
# https://www.freecadweb.org/wiki/User:Eriossoltero
# 13/03/2012, 29/07/2019
import Part, FreeCAD, math, PartGui, FreeCADGui
from FreeCAD import Base

# get the selected objects, with first selection for the trajectory and second for the section
# Adapted from:
# Macro Begin: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
import Part, FreeCAD, math, PartGui, FreeCADGui
from FreeCAD import Base

# get the selected objects, with first selection for the trajectory and second for the section
# Adapted from:
# http://freecad-tutorial.blogspot.com/2011/12/engine-9-poly-v-belt.html
s = FreeCADGui.Selection.getSelection()
try:
    sel1=s[0].Shape
    sel2=s[1].Shape
    sel3=s[2].Shape
    pt_center = sel1.Point
    pt_radmay = sel2.Point
    pt_radmen = sel3.Point
    
    # create Part object in the current document
    myObject=App.ActiveDocument.addObject("Part::Feature","Ellipse")
    
    # create a shape and assign it to the current document
    ellipse = Part.Ellipse(pt_radmay, pt_radmen, pt_center)
    myObject.Shape = ellipse.toShape()
    # Macro End: Ellipse-Center+2Points.FCMacro +++++++++++++++++++++++++++++++++++++++++++++++++

except:
    print( "Wrong selection")
    print( "First:centre, Second:major radius and Third:minor radius")