Example #1
0
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU Lesser General Public License for more details.
##
##You should have received a copy of the GNU Lesser General Public License
##along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.

import os

from OCC.Display.SimpleGui import init_display
from OCC.Core.Addons import text_to_brep, register_font, Font_FA_Regular

display, start_display, add_menu, add_function_to_menu = init_display()

# register the Respective font
register_font(os.path.join('..', 'assets', 'fonts', 'Respective.ttf'))

# Poetry from Paul Verlaine, Chanson d'Automne
text = """Les sanglots longs
Des violons
De l'automne
Blessent mon cœur
D'une langueur monotone

Tout suffocant
Et blême, quand
Sonne l'heure,
Je me souviens
Des jours anciens
Et je pleure
# You should have received a copy of the GNU Lesser General Public License
# along with pythonOCC.  If not, see <http://www.gnu.org/licenses/>.

import os

from OCC.Display.SimpleGui import init_display
from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Dir
from OCC.Core.gp import gp_Ax1, gp_Ax2, gp_Ax3
from OCC.Core.gp import gp_Trsf
from OCC.Core.TopLoc import TopLoc_Location
from OCC.Core.Addons import text_to_brep, register_font, Font_FA_Regular, Font_FA_Undefined

display, start_display, add_menu, add_function_to_menu = init_display()

# resgister font
register_font("./fonts/Respective.ttf")
register_font("./fonts/METROLOX.ttf")

text = """
Japan
"""

# create a basic string
arialbold_brep_string1 = text_to_brep(text, "Respective", Font_FA_Regular, 10.,
                                      True)

arialbold_brep_string2 = text_to_brep(text, "METOLOX", Font_FA_Regular, 10.,
                                      True)

trf = gp_Trsf()
trf.SetDisplacement(gp_Ax3(), gp_Ax3(gp_Pnt(0, 20, 0), gp_Dir(0, 0, 1)))