Code: Select all
view = FreeCAD.ActiveDocument.addObject('TechDraw::DrawViewSymbol','ViewSymbol')
view.Symbol = "<svg>... some svg fragment</svg>"
view.DimPoints = [(15.0,34.5),(256.65,45.76),...]
Code: Select all
view = FreeCAD.ActiveDocument.addObject('TechDraw::DrawViewSymbol','ViewSymbol')
view.Symbol = "<svg>... some svg fragment</svg>"
view.DimPoints = [(15.0,34.5),(256.65,45.76),...]
QScreen::physicalDotsPerInchX() and QScreen::physicalDotsPerInchY()??yorik wrote: ↑Fri Aug 16, 2019 1:43 pm One thing, though, this code has the same limitation as the one I'm using now: the view size is obtained in pixels, which could give quite a lot of imprecision (enough to change the value of a dimension, for ex). But I suppose we'll have to live with it for now, there might be further checks we can apply later on to refine the scale factor.
Currently, DrawViewSymbol doesn't know anything about geometry. I wonder if I shouldn't make a "made to measure" feature that would use the Svg as a "background", then overlay a geometry llayer.yorik wrote: ↑Fri Aug 16, 2019 1:49 pmThe last line would define points that are in the same coordinate system as the SVG, that would allow TD to use as dimension points, and therefore allow TD to place dimension on SymbolViews. Do you think that would be hard to implement?Code: Select all
view = FreeCAD.ActiveDocument.addObject('TechDraw::DrawViewSymbol','ViewSymbol') view.Symbol = "<svg>... some svg fragment</svg>" view.DimPoints = [(15.0,34.5),(256.65,45.76),...]
The values would still be ints... That means a window of, say 800x600, would basically divide a length of possibly thousands of units into just 800 units... but maybe coin holds a more precise value, I'll look into it.wandererfan wrote: ↑Fri Aug 16, 2019 1:57 pm QScreen::physicalDotsPerInchX() and QScreen::physicalDotsPerInchY()??
The idea basically would be that TD doesn't have anymore to care about the geometry. It would receive a list of points that it would be able to highlight in green and put dimensions between those points (considering the view scale of course). Of course it wouldn't be able to dimension lines just yet, but hat would be a good start already...wandererfan wrote: ↑Fri Aug 16, 2019 2:08 pm Currently, DrawViewSymbol doesn't know anything about geometry. I wonder if I shouldn't make a "made to measure" feature that would use the Svg as a "background", then overlay a geometry llayer.
Sorry, didn't express myself well. I meant that DrawViewSymbol would need a place to store the points in a way that the selection and dimension code could access it.yorik wrote: ↑Fri Aug 16, 2019 6:02 pm The idea basically would be that TD doesn't have anymore to care about the geometry. It would receive a list of points that it would be able to highlight in green and put dimensions between those points (considering the view scale of course). Of course it wouldn't be able to dimension lines just yet, but hat would be a good start already...
Maybe...
I guess similar to TechDraw_CosmeticVertex functionality. Things like dimensioning arcs wouldn't be supported, though.wandererfan wrote: ↑Fri Aug 16, 2019 10:16 pmSorry, didn't express myself well. I meant that DrawViewSymbol would need a place to store the points in a way that the selection and dimension code could access it.yorik wrote: ↑Fri Aug 16, 2019 6:02 pm The idea basically would be that TD doesn't have anymore to care about the geometry. It would receive a list of points that it would be able to highlight in green and put dimensions between those points (considering the view scale of course). Of course it wouldn't be able to dimension lines just yet, but hat would be a good start already...
Very cool indeed! <handsClapping \>yorik wrote: ↑Wed Aug 21, 2019 10:06 pm I also did some cool progress. With git commit f93a986b5a, TechDraw Arch views now have a third rendering mode called "Coin", besides Wireframe and Solid. It is still very unoptimized (some booleans are still performed, there could be more caching, etc...) but it works pretty well already!
I've had updating problems for a while but I haven't addressed them because of the plan to make drawings only update on demand.there is aweird problem in that file with objects not updating, but it's related to the link merge I think, will investigate later)
That would be cool! I don't think that functionality is used much (yet ) so probably it's relatively safe to extend...wandererfan wrote: ↑Wed Aug 21, 2019 11:53 pm I'd like to maybe subclass SoFCVectorizeSVGAction to fix some of these without impacting the current functionality. Maybe we can reduce the amount of SVG parsing required, too.
Yes, basically the same thing. What do you think would be needed to have such cosmetic points system on a TD ArchView @wandererfan? Also there would likely be many for a single view. Maybe all TD views could gain a property that holds such points? (CosmeticPoints?)