Back to index

salome-geom  6.5.0
GEOM_Sketcher.py
Go to the documentation of this file.
00001 #  -*- coding: iso-8859-1 -*-
00002 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00003 #
00004 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00005 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00006 #
00007 # This library is free software; you can redistribute it and/or
00008 # modify it under the terms of the GNU Lesser General Public
00009 # License as published by the Free Software Foundation; either
00010 # version 2.1 of the License.
00011 #
00012 # This library is distributed in the hope that it will be useful,
00013 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 # Lesser General Public License for more details.
00016 #
00017 # You should have received a copy of the GNU Lesser General Public
00018 # License along with this library; if not, write to the Free Software
00019 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00020 #
00021 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00022 #
00023 
00024 #  GEOM GEOM_SWIG : binding of C++ omplementaion with Python
00025 #  File   : GEOM_Sketcher.py
00026 #  Author : Damien COQUERET, Open CASCADE
00027 #  Module : GEOM
00028 #  $Header: /home/server/cvs/GEOM/GEOM_SRC/src/GEOM_SWIG/GEOM_Sketcher.py,v 1.8.2.2.10.4.14.1 2012-04-13 05:48:08 vsr Exp $
00029 #
00030 import geompy
00031 
00032 #SKETCHER INFOS
00033 #Init Sketcher
00034 #Create a string beginning by :"Sketcher:"
00035 #Each command must be separated by ":"
00036 #"F x y" : Create first point at X & Y
00037 
00038 #To Make Segment
00039 #"R angle" : Set the direction by angle
00040 #"D dx dy" : Set the direction by DX & DY
00041 
00042 #"TT x y" : Create by point at X & Y
00043 #"T dx dy" : Create by point with DX & DY
00044 #"L length" : Create by direction & Length
00045 #"IX x" : Create by direction & Intersect. X
00046 #"IY y" : Create by direction & Intersect. Y
00047 
00048 #To Make Arc
00049 #"C radius length" : Create by direction, radius and length(in degree)
00050 #"AA x y": Create by point at X & Y
00051 #"A dx dy" : Create by point with DX & DY
00052 #"UU x y radius flag1": Create by point at X & Y with given radiUs 
00053 #"U dx dy radius flag1" : Create by point with DX & DY with given radiUs
00054 #"EE x y xc yc flag1 flag2": Create by point at X & Y with given cEnter 
00055 #"E dx dy dxc dyc radius flag1 flag2" : Create by point with DX & DY with given cEnter
00056 
00057 #Flag1 is 0 or 2 ... 
00058 # if 0 the drawn arc is the one of lower angle (< Pi)
00059 # if 2 the drawn arc ius the one of greater angle (> Pi)
00060 
00061 #Flag2 is 0 or 1 ...
00062 # if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
00063 # if 1 the wire is built only if the end point is on the arc 
00064 #   with a tolerance of 10^-7 on the distance else the creation fails
00065 
00066 #To finish
00067 #"WW" : Close Wire
00068 
00069 #Create Sketcher
00070 Cmd = "Sketch:F 0 0:TT 0 100:C 100 180:AA -100 100:WW"
00071 Sketcher = geompy.MakeSketcher(Cmd) #(string)->GEOM_Shape_ptr
00072 
00073 #Add In Study
00074 id_Sketcher = geompy.addToStudy(Sketcher, "Sketcher")