[Solved] TD_DraftView does not work with Group folders in FC 0.19

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

[Solved] TD_DraftView does not work with Group folders in FC 0.19

Post by bitacovir »

TechDraw_DraftView does not work with Group folders in FC 0.19 It shows a message saying "Wrong selection. There were no DraftWB object in the selection". However, It should work as is indicated in the wiki. https://wiki.freecadweb.org/TechDraw_DraftView

-Create a group folder
-Put some Draft object in the folder
-Create a TechDraw page
-Select the folder in the tree view
-Click on TechDraw_DraftView tool. The message is shown.

This looks like a regression. In FC 0.18.4 TechDraw_DraftView tool works with group folders as is expected.
qUBmededQE.gif
qUBmededQE.gif (284 KiB) Viewed 1374 times
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24267 (Git)
Build type: Release
Branch: master
Hash: b2ca86d8d72b636011a73394bf9bcdedb3b109b7
Python version: 3.8.8
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/United States (en_US)
Last edited by bitacovir on Sun Mar 21, 2021 1:42 pm, edited 1 time in total.
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
Syres
Veteran
Posts: 2901
Joined: Thu Aug 09, 2018 11:14 am

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by Syres »

bitacovir wrote: Sat Mar 20, 2021 1:52 pm This looks like a regression. In FC 0.18.4 TechDraw_DraftView tool works with group folders as is expected.
There was a decision made many months ago when @vocx did the Draft Wb big changes to make code easier to read/find that broke the C++ code in Techdraw Draft object lookup. It was also shortly after @Yorik brought Layers up-to-date. I'm fairly certain it was then decided that generic Groups should not be used for this purpose but Layers instead which I understand is a enhanced Group object but I'm at the edge of my understanding here.

So a change rather than a regression is the way I would describe it.

You'll also notice that this will be deprecated in the future.

OS: Windows 7 Version 6.1 (Build 7601: SP 1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: releases/FreeCAD-0-19
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United Kingdom (en_GB)
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by bitacovir »

Syres wrote: Sat Mar 20, 2021 2:28 pm There was a decision made many months ago when @vocx did the Draft Wb big changes to make code easier to read/find that broke the C++ code in Techdraw Draft object lookup. It was also shortly after @Yorik brought Layers up-to-date. I'm fairly certain it was then decided that generic Groups should not be used for this purpose but Layers instead which I understand is a enhanced Group object but I'm at the edge of my understanding here.

So a change rather than a regression is the way I would describe it.

You'll also notice that this will be deprecated in the future.
yes. You are right. It works with Layers. Wiki should be updated.
But I don't understand what will be deprecated. DraftView? what is the replacement?
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
domad
Veteran
Posts: 2096
Joined: Mon Jun 22, 2020 12:16 pm

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by domad »

bitacovir wrote: Sat Mar 20, 2021 4:51 pm ......................
yes. You are right. It works with Layers. Wiki should be updated.
But I don't understand what will be deprecated. DraftView? what is the replacement?
Good morning to the Community, hello bitacovir!

You have to change the last phase:

- Create a group folder
-Put some Draft object in the folder
- Create a TechDraw page
-Select the folder in the tree view

- Click on TechDraw "Insert a view"

It also works with Sketch groupings, here you can see a workflow (step-by-step) to generate very complex technical drawings
https://forum.freecadweb.org/viewtopic. ... 9&start=10
here the wiki
https://wiki.freecadweb.org/Advanced_TechDraw_Tutorial (has yet to be completed)
You could do without the insert Draft object button, except that it can be used to insert the Draft "dimension" object to create quoted axonometries in TechDraw, as explained here https://forum.freecadweb.org/viewtopic.php?f=28&t=53848
Good weekend
Syres
Veteran
Posts: 2901
Joined: Thu Aug 09, 2018 11:14 am

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by Syres »

bitacovir wrote: Sat Mar 20, 2021 4:51 pm But I don't understand what will be deprecated. DraftView? what is the replacement?
After a bit of digging, line 125 of src\Mod\Techdraw\App\DrawViewDraft.cpp fires off a Python command including Draft.getSVG :

Code: Select all

        Base::Interpreter().runStringArg("svgBody = Draft.getSVG(App.activeDocument().%s %s)",
                                         SourceName.c_str(),paramStr.str().c_str());
and it's that function that will be deprecated in favour of Draft.get_svg. I'll do a few tests on my Linux compiled version and put in a PR to correct it and stop the error in future.
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by bitacovir »

Syres wrote: Sun Mar 21, 2021 11:06 am
and it's that function that will be deprecated in favour of Draft.get_svg. I'll do a few tests on my Linux compiled version and put in a PR to correct it and stop the error in future.
Thanks for your work...
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by bitacovir »

domad wrote: Sun Mar 21, 2021 8:56 am
You have to change the last phase:

- Create a group folder
-Put some Draft object in the folder
- Create a TechDraw page
-Select the folder in the tree view

- Click on TechDraw "Insert a view"

It also works with Sketch groupings, here you can see a workflow (step-by-step) to generate very complex technical drawings
https://forum.freecadweb.org/viewtopic. ... 9&start=10
here the wiki
https://wiki.freecadweb.org/Advanced_TechDraw_Tutorial (has yet to be completed)
You could do without the insert Draft object button, except that it can be used to insert the Draft "dimension" object to create quoted axonometries in TechDraw, as explained here https://forum.freecadweb.org/viewtopic.php?f=28&t=53848
Good weekend
Thanks for your workflow. I will study it.
I produce arch drawings. I use TD_DraftView in Techdraw because I use Draf_Dimensions and Axes and line projections, and with TD_DraftView I can apply in properties line styles with SVG patterns. I don't use TD_dimensions or cosmetic things to avoid toponaming in further editions. This is my goal:
FinalDrawing.FCStd
(71.57 KiB) Downloaded 27 times
freecad_2ZcX7Mrmtt.png
freecad_2ZcX7Mrmtt.png (197.96 KiB) Viewed 1245 times
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
domad
Veteran
Posts: 2096
Joined: Mon Jun 22, 2020 12:16 pm

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by domad »

bitacovir wrote: Sun Mar 21, 2021 1:27 pm .................
Thanks for your workflow. I will study it.
I produce arch drawings. I use TD_DraftView in Techdraw because I use Draf_Dimensions and Axes and line projections, and with TD_DraftView I can apply in properties line styles with SVG patterns. I don't use TD_dimensions or cosmetic things to avoid toponaming in further editions. This is my goal:

FinalDrawing.FCStd
freecad_2ZcX7Mrmtt.png
........I can tell you that, in general, your workflow is similar
User avatar
Carlos Alberto
Posts: 10
Joined: Thu Mar 18, 2021 3:49 pm
Location: Colombia
Contact:

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by Carlos Alberto »

bitacovir wrote: Sun Mar 21, 2021 1:27 pm
Thanks for your workflow. I will study it.
I produce arch drawings. I use TD_DraftView in Techdraw because I use Draf_Dimensions and Axes and line projections, and with TD_DraftView I can apply in properties line styles with SVG patterns. I don't use TD_dimensions or cosmetic things to avoid toponaming in further editions. This is my goal:

FinalDrawing.FCStd
freecad_2ZcX7Mrmtt.png
Sorry, but I don't understand, I also work creating architectural drawings and I find it easier to create a Section Plane in the model view looking and cutting the building according the views I need to show for a construction license and then create a view on the TechDraw page using the ArchView option link to that Section Plane, only problem is the linetypes like dashed and dashdot lines are not shown that way on the ArchView object on the TechDraw page, they're all shown as solid lines.
Arch. Carlos Alberto
Architecture + 3D Animation
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: TD_DraftView does not work with Group folders in FC 0.19

Post by bitacovir »

Carlos Alberto wrote: Tue Apr 27, 2021 12:46 am
Sorry, but I don't understand, I also work creating architectural drawings and I find it easier to create a Section Plane in the model view looking and cutting the building according the views I need to show for a construction license and then create a view on the TechDraw page using the ArchView option link to that Section Plane, only problem is the linetypes like dashed and dashdot lines are not shown that way on the ArchView object on the TechDraw page, they're all shown as solid lines.
In TechDraw what I do is to use TD DraftView with Draft elements (lines, etc).
In properties of TD DraftView you will find Data/LineStyle. There you should write a SVG line pattern like 0.20,0.20 or 5,2,0,5,2 (changing the numbers will give you different line patterns).
Also you must change Data/Override Style to True.

So, my strategy is to generate all 2D sections and views from Section Planes with Draft Shape2DView command and I put them inside a Draft Layer.
Then, I draw all lines and objects that will be dashed and dashdot in a separated Draft layer.
So, I select the layer with Shape2DView elements and generate a TD DraftView in the TD page. And I select the second layer and generate a new TD DraftView. Here with this last TDdraftview I set up the properties as I explained before. Finally, in the TD page I overlap both DraftViews to create a composition.
You can check my file attached in this thread. Also, you can see the last part of this tutorial: https://wiki.osarch.org/index.php?title ... D_workflow
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
Post Reply