Hello,
It could be very useful if techdraw were able to copy Edge/Lines colors from the 3Dview to retreive it in generated views, and also set this color when you do a dxf export !
The best should be to detect Draft.Layers and create them in the view->dxf export
It is very important when you do architecture/building plans, to separate parts by layers or colors.
In other way, TechDraw could provide python functions to retreive an array of hidden lines coordinates, and one array of lines by Shapes converted
I tried to read the cpp code from TechDraw but Iâm unable to do that, itâs too hard for me.
Hello Iâve made some screenshots :
Here is my 3D view :
if I generate view I have good hidden lines job ! but no line color :
Finally if I export to dxf, this is what I have, only one layer called âviewâ, no hidden lines separation:
And know Iâve made a script with dxf layer creation :
this is what it generate, all layers are created, but Iâm unable to calculate and separate hidden lines⊠:
Ădit: I think i have to work with viewobject, and not Shapes objectâŠ
Hidden lines are calculated by the OCC Hidden Line Removal (HLR) algorithms. Once a shape passes through HLR any connection between Edges in the source and Edges in the result is lost. So there is no way of knowing what appearance attributes in source belong with which object in the result. In addition, the face detection logic has to break some Edges into pieces.
There are special cases where this is possible - ex Sketches donât need to have hidden lines removed so there is a 1:1 correspondence between source geometry and result geometry and Sketcher appearance attributes could be carried over to the drawing.
So i think thereâs a way to make it up.
First : I would like to retreive shapeâs lines in 2d (exactly has shown in 3dview), techDraw does, so why not me ?
retreive once with shaded ( hidden line not shown) HLR ?
retreive twice with all lines .
try to find intersections between hidden and not hidden â remove doubles â separate hidden lines â and to finish separate visible lines in different layers.
Iâm unable to retreive 2d coordinates of shown shapes like teckDraw does.
Where I Have to find ? in Gui.ViewProvider ? in coin ?
Is HLR accesible in python ?
Do you think itâs possible to combine HLR, with another extraction method and compare/merge the two results ??
Ok,
wandererfan(thanks):I probably know how hidden lines are calculated. It use OpenCasCade, yes ?. And now, How do you pass Shape in OCC and retreive result in python ?
My way should be(probably) to pass, shape by shape and compare the result with all shapes passed with HLR algo.
I think itâs not impossible, we just have to send more OCC calculations and merge/compare them.
I just want functions to export my shapes viewed in 3D in OCC functions/doc to start my tests.
I donât know how to do ⊠itâs frustrating
Note that with recent 0.19 versions, if you use the Draft view, it now has an option to keep original line width/colors/style. This gives pretty faithful autocad-like sheetsâŠ
But Draft views donât work for 3D of course⊠One solution for 3D is to use the Coin view feature of Arch views. Not sure line colors are working though⊠Needs some testing
arf,
Just a small problem. if I Extract Layer by layer, the projections havenât got the same coordinates
in red : all the model
in green dashed : hidden lines
in other colors, the layer separation
do I have to pass an argument to the TechDraw.View object ?
this seems that the view is centered on the selected objects. I think that if I create a bounding box(a container) of my render, all my layers will have the same coordinates, isnât it ?
Iâve worked on it today.
this is the source :
Now I Have layers aligned by creating bounding box:
here is the model exported with âtempâ line in red :
and if I hide âtempâ layer:
Now I have to suppress doubles, remove the bounding box, and the hardest point, color splitted lines
EDIT: after remove doubles
Is there a function to test if edges are collinear ? I will have to test that to color splitted lines
Iâve to rework on bounding box lines, they have to be more small to not much interact with the render
from WFrame import WFDxfExport
export = WFDxfExport.DxfExport(Gui.Selection.getSelection())
export.extractLayers()
export.extractModel()
export.save()
You have to select objects and layers you want to export before launch
(sorry I havenât made security to launch with no selected objects at the moment !)
this is the source :
and this is the result in draftsight :
Iâm very very happy
They are some mistakes but itâs quite good !
update my github workbench if you want to use it.
Iâll make button and dialog taskbox to use it in few days
I think this tool has not his place in draft, but more probably in arch. Iâm trying to make functions to use it easly, so I will post discussion after the tool will be released.
It will probably work for draft objects too !
EzDxf is a python library/package(MIT licence) that provide good functions to create/write dxf files. A member told me itâs existance, and I tried. https://ezdxf.readthedocs.io/en/master/
Just for reference, Arch is built on top of Draft. Arch actually uses the Draft routines to export DXFs and do many other things, so thatâs why I suggest adding the code directly to Draft.