FreeCADDocu:Sandbox: Difference between revisions

From FreeCAD Documentation
mNo edit summary
(Removed Start and Web WB.)
 
(43 intermediate revisions by 8 users not shown)
Line 1: Line 1:
== Test ==
=Arch_SectionPlane/fr=
This is some line, and then {{incode|some inline code}}
{{GuiCommand/fr|Name=Arch SectionPlane|Name/fr=Arch Section Plan|Workbenches=[[Arch Module/fr|Arch]]|MenuLocation=Arch → Section Plane|Shortcut=S P}}


This is some line, and then {{code|inline=y|font-family: 'Times New Roman', serif;}}
==Description==


[[Draft Line]] and [[Draft_Line]]
Cet outil place le document courant dans un '''plan''', qui définit une section ou plan de la vue.<br>
Le '''plan''' peut être déplacé et réorienté, en le déplaçant, et, en le tournant, jusqu'à ce qu'il décrive le '''plan 2D''' que vous souhaitez voir sur le {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|plan de coupe]]}}.<br>
L'objet {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|plan de coupe]]}} ne calculera que les objets qui ont été sélectionnés lorsqu'il a été créé.<br>
Plus tard, les objets pourront être {{KEY|[[Image:Arch_Add.png|16px|text-top=Arch_Add|link=Arch_Add/fr]] [[Arch_Add/fr|ajoutés]]}} ou {{KEY|[[Image:Arch_Remove.png|16px|text-top=Arch_Remove|link=Arch_Remove/fr]] [[ Arch_Remove/fr|supprimés]]}} d'un objet {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|plan de coupe]]}}.<br>
À sa création, l'objet {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|plan de coupe]]}} peut également {{KEY|[[Image:Drawing_View.png|16px|text-top=Insérer une vue|link=Drawing_View/fr]] [[Drawing_View/fr|insèrer une vue]]}} d'elle même dans la [[Drawing Module/fr|page de dessin]] active, ou créez une nouvelle page, si aucune n'existe. Vous pouvez également ajouter des {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|plans de coupe]]}} directement dans le document, à l'aide de l'outil de l'outil {{KEY|[[Image:Draft_Shape2DView.png|16px|text-top=Draft_Shape2DView|link=Draft_Shape2DView/fr]] [[Draft_Shape2DView/fr|Draft_Shape2DView]]}} avec un {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|plan de coupe]]}} sélectionné.
<br><br>
[[Image:Arch SectionPlane example.jpg|800px]]
<br><br>
==Utilisation==


{| class="fcinfobox wikitable ct" width=100% height=100% style="float: right; width: 230px; margin-left: 1em" |
# Sélectionner l'objet ou les objets à projeter sur le '''plan'''.
| class="ctTitle" style="font-weight: bold; font-size: 114%;" |
# Appuyez sur le bouton {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|ajouter un plan de coupe]]}} ou pressez les touches {{KEY|S}} et {{KEY|P}}.
[[Image:NoIconFound.png|32px|Official icon not found]] {{{Name}}}
# [[Draft Move|Déplacer]]/[[Draft Rotate|/tourner]] {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|le plan]]}} dans sa position correcte.
|-
# Appuyez sur le {{KEY|[[Image:Std_Recompute.png|16px|text-top=Std_Recompute|link=Std_Recompute/fr]] [[Std_Refresh/fr|raffraichir]]}} pour mettre la vue à jour.
! class="ctOdd"|Menu location
|-
| class="ctEven"|{{{MenuLocation}}}
|-
! class="ctOdd"|Workbenches
|-
| class="ctEven"|{{{Workbenches}}}
|}


{| class="wikitable" style="width: 100%;"
==Options==
|style="width: 18%;" | '''Installation:'''
||[[Installing_on_Linux|Linux]], [[Installing_on_Windows|Windows]], [[Installing_on_Mac|Mac]]; '''[[Getting started]]'''
|--
|-
|style="font-weight:bold;" | Basics:
||[[About FreeCAD]], [[Workbenches]], [[Preferences Editor|Preferences]], [[Document structure]], [[Interface Customization]], [[Property|Properties]], [[Mouse_navigation|Mouse navigation]]
|-
|-
|style="font-weight:bold;" | Core workbenches:
||[[Draft Workbench|Draft]], [[Part Workbench|Part]], [[PartDesign Workbench|PartDesign]], [[Sketcher Workbench|Sketcher]], [[TechDraw Workbench|TechDraw]]
|-
|style="font-weight:bold;" | Expert workbenches:
||[[Arch Workbench|Arch]], [[CAM Workbench|CAM]], [[FEM Workbench|FEM]], [[Inspection Workbench|Inspection]], [[Mesh Workbench|Mesh]], [[OpenSCAD Workbench|OpenSCAD]], [[Points_Workbench|Points]], [[Raytracing Workbench|Raytracing]], [[Reverse Engineering Workbench|Reverse Engineering]], [[Robot Workbench|Robot]], [[Ship Workbench|Ship]]
|-
|style="font-weight:bold;" | Auxiliary workbenches:
||[[Plot Workbench|Plot]], [[Spreadsheet Workbench|Spreadsheet]], [[Debugging|Test Framework]]
|}


=== HowTo test ===
* Après avoir sélectionné un {{KEY|[[Image:Arch_SectionPlane.png|16px|text-top=Arch_SectionPlane|link=Arch_SectionPlane/fr]] [[Arch_SectionPlane/fr|plan de coupe]]}}, utilisez l'outil de {{KEY|[[Image:Draft_Shape2DView.png|16px|text-top=Draft_Shape2DView|link=Draft_Shape2DView/fr]] [[Draft_Shape2DView/fr|Draft_Shape2DView]]}} pour créer un objet shape qui représente l'affichage de la section dans le document
Experimental HowTo page: [[Sandbox:HowTo]]
<br>
[[Image:Arch Section example2.jpg|800px]]
<br><br>
* Sélectionnez un nouvel objet objet {{KEY|[[Image:Drawing_View.png|16px|text-top=Drawing_View|link=Drawing_View/fr]] [[Drawing_View/fr|vue]]}}, utilisez l'outil de {{KEY|[[Image:Draft_Shape2DView.png|16px|text-top=Draft_Shape2DView|link=Draft_Shape2DView/fr]] [[Draft_Shape2DView/fr|Shape2DView]]}} pour créer un objet shape, qui représente l'affichage de la section dans le document.


[[#top|top]]
[[Image:Arch Section example3.jpg|800px]]


==Propriétés==
== Test code ==


'''Code|code='''
* {{ProprieteVue|Display Size}}: La taille du plan de coupe dans la vue 3D
{{Code|code=
import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
}}


==Script==
== Test python ==


'''Code|lang=python|code='''
L'outil Section de plan peut servir dans une [[macros/fr|macros]], et, à partir de la console '''Python''' en utilisant la fonction suivante :
{{Code|lang=python|code=
import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
}}


'''makeSectionPlane ([objectslist])''' : Crée le plan de coupe, objet inclus.


== Test pre ==
Exemple:


'''pre'''
import FreeCAD, Draft, Arch
<pre>
trace = Part.Line(FreeCAD.Vector (0, 0, 0),FreeCAD.Vector (2, 2, 0))
import math
wall = Arch.makeWall(trace,width=0.1,height=1,align="Center")
from pivy import coin
Arch.makeSectionPlane([wall])
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
</pre>


== Test syntaxhighlight ==
{{clear}}

<br>
'''syntaxhighlight lang="python"'''
{{LesOutilsArchitecturaux}}
<syntaxhighlight lang="python">
<br>
import math
{{languages/fr | {{en|Arch_SectionPlane}} {{es|Arch_SectionPlane/es}} {{it|Arch_SectionPlane/it}} {{jp|Arch_SectionPlane/jp}} {{se|Arch_SectionPlane/se}} }}
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))
</syntaxhighlight>

== Test source lang=python ==

'''source lang=python'''
<source lang=python>
import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))

</source>

== Test code ==

'''Code|code='''
{{Code|code=
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0.orig.tar.gz
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.dsc
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.diff.gz

dpkg-source -x opencascade_6.2.0-7.dsc

# Install OCC build-deps
sudo apt-get install build-essential devscripts debhelper autoconf automake libtool bison libx11-dev tcl8.4-dev tk8.4-dev libgl1-mesa-dev libglu1-mesa-dev java-gcj-compat-dev libxmu-dev

#Build Opencascade packages. This takes hours and requires
# at least 8 GB of free disk space
cd opencascade-6.2.0 ; debuild

# Install the resulting library debs
sudo dpkg -i libopencascade6.2-0_6.2.0-7_i386.deb
libopencascade6.2-dev_6.2.0-7_i386.deb

}}

== Test code=bash ==

'''Code|code=bash'''
{{Code|lang=bash|code=
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0.orig.tar.gz
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.dsc
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.diff.gz

dpkg-source -x opencascade_6.2.0-7.dsc

# Install OCC build-deps
sudo apt-get install build-essential devscripts debhelper autoconf automake libtool bison libx11-dev tcl8.4-dev tk8.4-dev libgl1-mesa-dev libglu1-mesa-dev java-gcj-compat-dev libxmu-dev

#Build Opencascade packages. This takes hours and requires
# at least 8 GB of free disk space
cd opencascade-6.2.0 ; debuild

# Install the resulting library debs
sudo dpkg -i libopencascade6.2-0_6.2.0-7_i386.deb
libopencascade6.2-dev_6.2.0-7_i386.deb

}}

== Test SystemInput ==

'''SystemInput''' template

{{SystemInput | sudo apt-get install build-essential devscripts debhelper autoconf automake libtool bison libx11-dev tcl8.4-dev tk8.4-dev libgl1-mesa-dev libglu1-mesa-dev java-gcj-compat-dev libxmu-dev}}


== Test syntaxhighlight ==

'''syntaxhighlight line'''
<syntaxhighlight lang="python" line>
from __future__ import division # allows floating point division from integers
import FreeCAD, Part, math
from FreeCAD import Base
class RectEllipseShape:
def __init__(self, obj):
''' Add the properties: Radius, Eccentricity, Height, Segments (see Property View) '''
obj.addProperty("App::PropertyLength","a","Rectellipse","A - horizontal radius").a = 16.0
obj.addProperty("App::PropertyLength","b","Rectellipse","B - vertical radius").b = 9.0
obj.addProperty("App::PropertyFloat","n","Rectellipse","N ").n=0.2
obj.addProperty("App::PropertyBool","createFace","Rectellipse","Wheter to create a face or not").createFace=True
obj.Proxy = self
def onChanged(self, fp, prop):
if prop == "a" or prop == "b" or prop == "n" or prop == "segments" or prop == "height" or prop == "createFace":
#if one of these is changed
self.execute(fp)
def execute(self, fp):
r1=fp.a
r2=fp.b
s=fp.n
z=0.0
p=1.0
####w=2**0.5/2.0 #Ellipse
w=2**0.5/2.0/(1-s**p)
curve=Part.BSplineCurve()
curve.setPeriodic()
curve.increaseDegree(2) #quadratic
curve.insertKnots([i*1.0/(4) for i in (1,2,3)],[2]*(3)) #5Knots 8 Poles
curve.setPole(1,FreeCAD.Vector(0,-r2,z),1)
curve.setPole(2,FreeCAD.Vector(-r1,-r2,z),w)
curve.setPole(3,FreeCAD.Vector(-r1,0,z),1)
curve.setPole(4,FreeCAD.Vector(-r1,r2,z),w)
curve.setPole(5,FreeCAD.Vector(0,r2,z),1)
curve.setPole(6,FreeCAD.Vector(r1,r2,z),w)
curve.setPole(7,FreeCAD.Vector(r1,0,z),1)
curve.setPole(8,FreeCAD.Vector(r1,-r2,z),w)
if fp.createFace == True:
fp.Shape = Part.Face(Part.Wire(curve.toShape()))
else:
fp.Shape = curve.toShape()
def makeRectellipseBlock():
doc = FreeCAD.activeDocument()
if doc == None:
doc = FreeCAD.newDocument()
obj=doc.addObject("Part::FeaturePython","RectEllipseShape") #add object to document
obj.Label = "RectEllipsse"
RectEllipseShape(obj)
obj.ViewObject.Proxy=0
viewObject = Gui.ActiveDocument.getObject(obj.Name)
viewObject.ShapeColor = (0.00,0.33,1.00)
viewObject.DisplayMode = "Flat Lines"
obj.Shape.check()
if __name__ == "__main__":
#feature will be generated after macro execution
makeRectellipseBlock()
</syntaxhighlight>


[[Category:Sandbox]]

Latest revision as of 09:11, 2 May 2024

Test

This is some line, and then some inline code

This is some line, and then

font-family: 'Times New Roman', serif;

Draft Line and Draft_Line

Official icon not found {{{Name}}}

Menu location
{{{MenuLocation}}}
Workbenches
{{{Workbenches}}}
Installation: Linux, Windows, Mac; Getting started
Basics: About FreeCAD, Workbenches, Preferences, Document structure, Interface Customization, Properties, Mouse navigation
Core workbenches: Draft, Part, PartDesign, Sketcher, TechDraw
Expert workbenches: Arch, CAM, FEM, Inspection, Mesh, OpenSCAD, Points, Raytracing, Reverse Engineering, Robot, Ship
Auxiliary workbenches: Plot, Spreadsheet, Test Framework

HowTo test

Experimental HowTo page: Sandbox:HowTo

top

Test code

Code|code=

import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
       self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
       self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))

Test python

Code|lang=python|code=

import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
       self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
       self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))


Test pre

pre

import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
       self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
       self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))

Test syntaxhighlight

syntaxhighlight lang="python"

import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
       self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
       self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))

Test source lang=python

source lang=python

 
import math
from pivy import coin
cam = Gui.ActiveDocument.ActiveView.getCameraNode()
rot.setValue(coin.SbVec3f(0,0,1),math.pi/2)
       self.lineEdit_1 = QtGui.QLineEdit(self.centralWidget)
       self.lineEdit_1.setGeometry(QtCore.QRect(320, 30, 151, 22))

Test code

Code|code=

wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0.orig.tar.gz
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.dsc
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.diff.gz

dpkg-source -x opencascade_6.2.0-7.dsc

# Install OCC build-deps
sudo apt-get install build-essential devscripts debhelper autoconf automake libtool bison libx11-dev tcl8.4-dev tk8.4-dev libgl1-mesa-dev libglu1-mesa-dev java-gcj-compat-dev libxmu-dev

#Build Opencascade packages. This takes hours and requires
# at least 8 GB of free disk space
cd opencascade-6.2.0 ; debuild

# Install the resulting library debs
sudo dpkg -i libopencascade6.2-0_6.2.0-7_i386.deb
libopencascade6.2-dev_6.2.0-7_i386.deb

Test code=bash

Code|code=bash

wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0.orig.tar.gz
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.dsc
wget http://lyre.mit.edu/~powell/opencascade/opencascade_6.2.0-7.diff.gz

dpkg-source -x opencascade_6.2.0-7.dsc

# Install OCC build-deps
sudo apt-get install build-essential devscripts debhelper autoconf automake libtool bison libx11-dev tcl8.4-dev tk8.4-dev libgl1-mesa-dev libglu1-mesa-dev java-gcj-compat-dev libxmu-dev

#Build Opencascade packages. This takes hours and requires
# at least 8 GB of free disk space
cd opencascade-6.2.0 ; debuild

# Install the resulting library debs
sudo dpkg -i libopencascade6.2-0_6.2.0-7_i386.deb
libopencascade6.2-dev_6.2.0-7_i386.deb

Test SystemInput

SystemInput template

sudo apt-get install build-essential devscripts debhelper autoconf automake libtool bison libx11-dev tcl8.4-dev tk8.4-dev libgl1-mesa-dev libglu1-mesa-dev java-gcj-compat-dev libxmu-dev


Test syntaxhighlight

syntaxhighlight line

from __future__ import division # allows floating point division from integers
import FreeCAD, Part, math
from FreeCAD import Base
 
class RectEllipseShape:
   def __init__(self, obj):
      ''' Add the properties: Radius, Eccentricity, Height, Segments (see Property View) '''
      obj.addProperty("App::PropertyLength","a","Rectellipse","A - horizontal radius").a = 16.0
      obj.addProperty("App::PropertyLength","b","Rectellipse","B - vertical radius").b = 9.0
      obj.addProperty("App::PropertyFloat","n","Rectellipse","N ").n=0.2
      obj.addProperty("App::PropertyBool","createFace","Rectellipse","Wheter to create a face or not").createFace=True
      obj.Proxy = self
 
   def onChanged(self, fp, prop):
      if prop == "a" or prop == "b" or prop == "n" or prop == "segments" or prop == "height" or prop == "createFace":
         #if one of these is changed
         self.execute(fp)
 
   def execute(self, fp):
      r1=fp.a
      r2=fp.b
      s=fp.n
      z=0.0
      p=1.0
      ####w=2**0.5/2.0 #Ellipse
      w=2**0.5/2.0/(1-s**p)
      curve=Part.BSplineCurve()
      curve.setPeriodic()
      curve.increaseDegree(2) #quadratic
      curve.insertKnots([i*1.0/(4) for i in (1,2,3)],[2]*(3)) #5Knots 8 Poles
      curve.setPole(1,FreeCAD.Vector(0,-r2,z),1)
      curve.setPole(2,FreeCAD.Vector(-r1,-r2,z),w)
      curve.setPole(3,FreeCAD.Vector(-r1,0,z),1)
      curve.setPole(4,FreeCAD.Vector(-r1,r2,z),w)
      curve.setPole(5,FreeCAD.Vector(0,r2,z),1)
      curve.setPole(6,FreeCAD.Vector(r1,r2,z),w)
      curve.setPole(7,FreeCAD.Vector(r1,0,z),1)
      curve.setPole(8,FreeCAD.Vector(r1,-r2,z),w)
      if fp.createFace == True:
         fp.Shape = Part.Face(Part.Wire(curve.toShape()))
      else:
         fp.Shape = curve.toShape()
 
def makeRectellipseBlock():
   doc = FreeCAD.activeDocument()
   if doc == None:
      doc = FreeCAD.newDocument()
   obj=doc.addObject("Part::FeaturePython","RectEllipseShape") #add object to document
   obj.Label = "RectEllipsse"
   RectEllipseShape(obj)
   obj.ViewObject.Proxy=0
   viewObject = Gui.ActiveDocument.getObject(obj.Name)
   viewObject.ShapeColor = (0.00,0.33,1.00)
   viewObject.DisplayMode = "Flat Lines"
   obj.Shape.check()
 
if __name__ == "__main__":
   #feature will be generated after macro execution
   makeRectellipseBlock()