hi all,
i have a question..
I searched but find anything…
perhaps i don’t know how use “search” but i find never nothing..
ok,
I created a logo in houdini in 2D
now, i want know if it’s possible to export my path in illustrator?
I read that .svg can make this, but i don’t found .svg.
I tried to export my geometry in dxf, but dxf divide my geometry into small parts et i can’t use this without more and more hours of work..
If someone can help me..
Thank you very much.
Best regards
it’s possible to export a .svg??
10407 7 5- supermac
- Member
- 120 posts
- Joined: June 2008
- Offline
- grayOlorin
- Member
- 1799 posts
- Joined: Oct. 2010
- Offline
Hey Super, I made one a while back for h11, but I have not used it in a while. it is implemented in python so you can probably just refactor to your needs. Hope it helps!
note that the SVG format is very easy to write to. If you need more info on the specifications, check out (www.w3schools.com)
note that the SVG format is very easy to write to. If you need more info on the specifications, check out (www.w3schools.com)
-G
- FakePilot
- Member
- 26 posts
- Joined: Aug. 2012
- Offline
- Michael Abrahams
- Member
- 14 posts
- Joined: June 2018
- Offline
How about this Python library for writing SVGs? https://pypi.org/project/svgwrite/ [pypi.org]
Edited by Michael Abrahams - Dec. 17, 2018 18:16:42
- tjeeds
- Member
- 339 posts
- Joined: Aug. 2007
- Offline
- FakePilot
- Member
- 26 posts
- Joined: Aug. 2012
- Offline
I can make the Entagma Python script create a SVG sequence. But trying to use grayOlorin's otl.
Because that one can have color as well.
Even though I managed to replicate it to export for every frame in a new python node, it then somehow does not output color.
Then I have to use the OTL and that has a button I have to click for every frame, for it to work.
Ps. I'm a pure newb when it comes to Python.
This code together with the right fields:
Because that one can have color as well.
Even though I managed to replicate it to export for every frame in a new python node, it then somehow does not output color.
Then I have to use the OTL and that has a button I have to click for every frame, for it to work.
Ps. I'm a pure newb when it comes to Python.
This code together with the right fields:
def exportSVG(): geo = hou.pwd().geometry() node = hou.pwd() filename = node.evalParm("location") sizeMult = node.evalParm("sizeMult") setColor = node.evalParm("setColorFromAttr") colorAttr = node.evalParm("colorAttr") addStroke = node.evalParm("addStroke") strokeColorR = node.evalParm("strokeColorr") strokeColorG = node.evalParm("strokeColorg") strokeColorB = node.evalParm("strokeColorb") strokeThickness = node.evalParm("strokeThickness") import xml.dom.minidom as minidom svgFile = minidom.Document() svgElement = svgFile.createElement("svg") svgFile.appendChild(svgElement) # Add code to modify the contents of geo. for prim in geo.prims(): positionString = "" for vertex in prim.vertices(): position = vertex.point().position() positionString = positionString + (str(position[0]*sizeMult) + "," + str(position[1]*sizeMult*-1) + " ") #now write to SVG polygonElement = svgFile.createElement("polygon") polygonElement.setAttribute("points", positionString) #Set Fill if (setColor == 1): color = prim.attribValue(colorAttr) red = hou.expandString("`inttohex(round(" + str(color[0]*255) + "))`") green = hou.expandString("`inttohex(round(" + str(color[1]*255) + "))`") blue = hou.expandString("`inttohex(round(" + str(color[2]*255) + "))`") hex = "#" + red[6:8] + green[6:8] + blue[6:8] polygonElement.setAttribute("fill", hex) else: polygonElement.setAttribute("fill", "None") #Set Stroke if (addStroke == 1): red = hou.expandString("`inttohex(round(" + str(strokeColorR*255) + "))`") green = hou.expandString("`inttohex(round(" + str(strokeColorG*255) + "))`") blue = hou.expandString("`inttohex(round(" + str(strokeColorB*255) + "))`") hex = "#" + red[6:8] + green[6:8] + blue[6:8] polygonElement.setAttribute("stroke", hex) polygonElement.setAttribute("stroke-width", str(strokeThickness)) svgElement.appendChild(polygonElement) #print svgFile.toprettyxml(indent=" ") #print filename newFile = open(hou.expandString(str(filename)),"w") newFile.write(svgFile.toprettyxml(indent=" ")) exportSVG()
Edited by FakePilot - Dec. 18, 2018 14:41:54
Houdini Indie 18
Win 10 64-bit
Win 10 64-bit
- jomaro
- Member
- 102 posts
- Joined: April 2017
- Offline
- supermac
- Member
- 120 posts
- Joined: June 2008
- Offline
-
- Quick Links