I cannot insert DraftText to TechDraw page.
I think, it maybe from Draft Annotation rename to "DraftText".
-------------------------------------
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.13870 (Git)
Build type: Release
Branch: master
Hash: f0964a9c052ee666631cd9caec1655790964ecb6
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)
[Solved]Cannot insert DraftText to TechDraw page.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
[Solved]Cannot insert DraftText to TechDraw page.
Last edited by chakkree on Sat Jun 02, 2018 3:33 am, edited 1 time in total.
Re: Cannot insert DraftText to TechDraw page.
Indeed, thanks for reporting. This is now fixed in git commit 93eb05b1b
Re: Cannot insert DraftText to TechDraw page.
Thank you very much.yorik wrote: ↑Fri Jun 01, 2018 2:06 pm Indeed, thanks for reporting. This is now fixed in git commit 93eb05b1b
Re: [Solved]Cannot insert DraftText to TechDraw page.
The first image use inserts draft button.
The second image uses the macro to manage each piece of Draft Object by function Draft.getSVG() to generate each SVG's element with different line type and line width of grids group.
The second image uses the macro to manage each piece of Draft Object by function Draft.getSVG() to generate each SVG's element with different line type and line width of grids group.
Code: Select all
#-*- coding:utf8 -*-
import FreeCADGui
import Draft
def TestGetSVG():
import Draft
sel = FreeCADGui.Selection.getSelection()[0]
for obj in sel.OutList:
Msg('%s , %s '%( obj.Label , Draft.getType(obj) ) )
Msg(', %s'%(Draft.getSVG(obj , scale=0.01 ,linestyle='5,2,1,2' ) ))
Msg('\n')
SVGHead = '''<svg
xmlns="http://www.w3.org/2000/svg" version="1.1"
xmlns:freecad="http://www.freecadweb.org/wiki/index.php?title=Svg_Namespace">
'''
SVGTail='</svg>'
def TestGetSVG2():
svg = ''
sel = FreeCADGui.Selection.getSelection()[0]
for obj in sel.OutList:
if Draft.getType(obj) in ['Wire' ]:
if obj.Label[:4]=='Grid':
svg += Draft.getSVG(obj , scale=0.01 , linestyle='5,1.5,1,1.5' ,
linewidth=0.18, techdraw=True)
else:
svg += Draft.getSVG(obj , scale=0.01 ,
linewidth=0.35, techdraw=True)
elif Draft.getType(obj) in ['Dimension' ]:
svg += Draft.getSVG(obj , scale=0.01,linewidth=0.25,techdraw=True )
elif Draft.getType(obj) in [ 'Circle' , 'Ellipse' ,'Rectangle' , 'Polygon' ]:
svg += Draft.getSVG(obj , scale=0.01,linewidth=0.25,techdraw=True )
elif Draft.getType(obj) in [ 'ShapeString' ,'DraftText']:
svg += Draft.getSVG(obj , scale=0.01, fontsize=3, linewidth=0, techdraw=True )
#Msg('%s\n'%svg)
svg = SVGHead + svg + SVGTail
symbol = FreeCAD.ActiveDocument.addObject('TechDraw::DrawViewSymbol','Symbol')
symbol.Symbol = svg
symbol.Scale = 1/100.0*3.78
FreeCAD.ActiveDocument.Page.addView(symbol)
FreeCAD.ActiveDocument.recompute()
if __name__=='__main__':
#TestGetSVG()
TestGetSVG2()
"""
sel = FreeCADGui.Selection.getSelection()[0]
Draft.getSVG(sel,scale=0.01 , techdraw=True)
Draft.getType(sel)
def getSVG(obj,scale=1,linewidth=0.35,
fontsize=12,fillstyle="shape color",
direction=None,linestyle=None,
color=None,linespacing=None,
techdraw=False,rotation=0):
isinstance(sel,Part.Shape)
"""
Re: [Solved]Cannot insert DraftText to TechDraw page.
Nice! It made me notice and fix a bug, draft texts were not appearing on file load...