Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
babaroga
Posts: 178
Joined: Sun Aug 14, 2016 6:52 pm
Location: Banja Luka, Republic of Srpska, Bosnia and Herzegovina

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by babaroga »

It will mean a lot, if there is something like isChildOf() property in pattern or mirror so you can trace back to original.
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by M4x »

First of all: Thank you very much for this great tool! I'm trying it out right now and I really appreciate it. I've found two things which didn't work as expected. In addition, I've some more questions and wishes ;)


chamfers
This one was already reported by Shalmeneser and apparently you've already worked on it. Nevertheless, I think it's not yet perfect.
Shalmeneser wrote: Sat Jul 10, 2021 8:29 pm Why the vertical and horizontal bevel dimensions are not the same for the angle ? (done with PartDesign_Chamfer : one dimension 1 mm)
edi wrote: Sun Jul 11, 2021 6:58 am [...]
The first two are issues I could fix. [...]
The attached example shows this behavior:
wrong chamfer angle
wrong chamfer angle
Snip macro screenshot-808ed9.png (13.53 KiB) Viewed 6792 times

changing line attributes
I assumed it would be enough to select any line and select one of the colors to change the color of the selected line. But nothing is happening here. What am I doing wrong?

edit: Clicking on "change the line attributes" doesn't work and gives me something like this:

Code: Select all

22:01:57  DVPPI::getCenterLinebySelection - centerLine for tag Edge8 not found
22:01:57  DVPPI::getCosmeticEdgebySelection - edge for name Edge8 not found

dimension symbol
Great that I'm now able to add the dimension symbol without copying it from the internet / looking up the UTF8-code :D But I've discovered that I'm not able to apply it to all kind of dimensions. It's not working with TechDraw_HorizontalExtentDimension and https://wiki.freecadweb.org/TechDraw_Ve ... tDimension.
HorizontalExtentDimension
HorizontalExtentDimension
Snip macro screenshot-cf2f43.png (7.52 KiB) Viewed 6792 times

example file for both cases:
TechDrawTools_chamfer_dimensionSimbol_v1.FCStd
example file
(21.28 KiB) Downloaded 111 times

feature request
I'd like to be able to center the "number" showing the value of a dimension at a (for example) horizontal dimension. I think that's the initial state after adding a dimension.


Wiki entry
I think this macro is missing here: Macros_recipes
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by edi »

M4x wrote: Sun Sep 19, 2021 7:25 pm chamfers
...But I've discovered that I'm not able to apply it to all kind of dimensions.
Replace in line 4387 "int" by "round"

Code: Select all

Alpha = str(round(math.degrees(abs(math.atan(Dx/Dy)))))
Check whether the same replacement has been made in line 4508

Code: Select all

Alpha = str(round(math.degrees(abs(math.atan(Dy/Dx)))))
The Chamfer-Tools should show the correct angle.

Extend line 2646 to

Code: Select all

if Elem.Object.TypeId == 'TechDraw::DrawViewDimension' or Elem.Object.TypeId == 'TechDraw::DrawViewDimExtent':
The ⌀-Tool should work with Extent Dimensions.
M4x wrote: Sun Sep 19, 2021 7:25 pm changing line attributes
I assumed it would be enough to select any line and select one of the colors to change the color of the selected line. But nothing is happening here. What am I doing wrong?
First select the attributes (type, line thickness, color).
If you create a new line using the macro (circle centerline, cosmetic thread etc.) it receives the selected attributes.
If you select existing cosmetic lines and press the "Change the line attributes" button, the lines change to the selected attributes.
M4x wrote: Sun Sep 19, 2021 7:25 pm feature request
I'd like to be able to center the "number" showing the value of a dimension at a (for example) horizontal dimension. I think that's the initial state after adding a dimension.
It is easy to realize this in python, but it will be difficult to handle it. Before manipulating any measure you have to select it. Only the measure value (number) can be selected. If you select it using the curser you usually move it a little bit (without aim). Therefore the positioning and cascading tools keep the position of the number. A solution could be to have an optional choice keep/center when using the position and cascade tools.
M4x wrote: Sun Sep 19, 2021 7:25 pm Wiki entry
I think this macro is missing here: Macros_recipes
OK, good idea I will try to do this.
domad
Veteran
Posts: 2052
Joined: Mon Jun 22, 2020 12:16 pm

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by domad »

Greetings to the Community!
.... two examples of how the corrections made to the code work
Attachments
Example_1_corrections_made.gif
Example_1_corrections_made.gif (400.48 KiB) Viewed 6691 times
Example_2_corrections_made.gif
Example_2_corrections_made.gif (320.5 KiB) Viewed 6691 times
User avatar
NoCom
Posts: 3
Joined: Sat Sep 18, 2021 8:05 am
Location: Moscow, Russia

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by NoCom »

edi wrote: Sun Sep 19, 2021 12:20 pm Please have a look at https://forum.freecadweb.org/viewtopic.php?f=35&t=59334.
Would be fine if somebody could translate into russian language.
Sorry for not writing росси́йский.
Done

Code: Select all

    def russianDict(self,textEnglish):
        dict_ = {"Attributes and Modifications":"Свойства и модификации",\
                "Centerlines and Threading":"Осевые линии и резьбы",\
                "Dimensions":"Размеры",\
                "Line attributes:":"Свойства линий:",\
                "Cascade spacing:":"Значение интервала:",\
                "Quit":"Выход",\
                "set lines to ":"установить тип линий ",\
                "solid":"сплошная",\
                "dashed":"пунктирная",\
                "dotted":"точечная",\
                "dashdot":"штрихпунктирная",\
                "set lines width to ":"установить толщину линий ",\
                "thick 0,70":"толстая 0,70",\
                "middle 0,35":"средняя 0,35",\
                "thin 0,18":"тонкая 0,18",\
                "set lines color to ":"установить цвет линий ",\
                "black":"черный",\
                "grey":"серый",\
                "red":"красный",\
                "green":"зеленый",\
                "blue":"синий",\
                "magenta":"пурпурный",\
                "cyan":"голубой",\
                "yellow":"желтый"}
        return dict_.get(textEnglish,textEnglish)
UPD. I will deal with the rest of the menu items later.
UPD 2. Fully Completed

Code: Select all

-------------174
    def russianDict(self,textEnglish):
        dict_ = {"Attributes and Modifications":"Свойства и модификации",\
                "Centerlines and Threading":"Осевые линии и резьбы",\
                "Dimensions":"Размеры",\
                "Line attributes:":"Свойства линий:",\
                "Cascade spacing:":"Значение интервала:",\
                "Quit":"Выход",\
                "set lines to ":"установить тип линий ",\
                "solid":"сплошная",\
                "dashed":"пунктирная",\
                "dotted":"точечная",\
                "dashdot":"осевая",\
                "set lines width to ":"установить толщину линий ",\
                "thick 0,70":"толстая 0,70",\
                "middle 0,35":"средняя 0,35",\
                "thin 0,18":"тонкая 0,18",\
                "set lines color to ":"установить цвет линий ",\
                "black":"черный",\
                "grey":"серый",\
                "red":"красный",\
                "green":"зеленый",\
                "blue":"синий",\
                "magenta":"пурпурный",\
                "cyan":"голубой",\
                "yellow":"желтый"}
        return dict_.get(textEnglish,textEnglish)		
----------------797		
    def textEnglish(self):
        buttonText = "Рисовать линии центра окружности"
        helpText = "Рисовать линии центра окружности:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите несколько окружностей или дуг"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)		
-------------1147	
    def textEnglish(self):
        buttonText = "Рисовать окружность центров отверстий"
        helpText = "Рисовать окружность центров отверстий:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите не менее 3-х отверстий, лежащих на одной окружности"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------1300
    def textEnglish(self):
        buttonText = "Рисовать осевую линию"
        helpText = "Рисовать осевую линию по двум линиям:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите две линии"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------1566
    def textEnglish(self):
        buttonText = "Обозначение резьбы отверстия в плане"
        helpText = "Обозначить резьбу отверстия в плане:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите несколько окружностей"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------1883
    def textEnglish(self):
        buttonText = "Обозначение резьбы вала в плане"
        helpText = "Обозначить резьбу болта, штифта, вала в плане:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите окружности, обозначающие болт, штифт, вал"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2011
    def textEnglish(self):
        buttonText = "Обозначение резьбы на виде сбоку"
        helpText = "Рисовать обозначение резьбы на виде сбоку:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите две параллельные линии"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2136
    def textEnglish(self):
        buttonText = "Обозначение резьбы вала на виде сбоку либо разрезе"
        helpText = "Обозначить резьбу болта, штифта, вала на виде сбоку либо разрезе:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите две параллельные линии, обозначающие резьбовую часть болта, штифта, вала"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2290
    def textEnglish(self):
        buttonText = "Создать точки на пересечении"
        helpText = "Создать точки на пересечении линий:"+ "\n"\
                   "- выберите две линии, окружности, дуги"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2449
    def textEnglish(self):
        buttonText = "Изменить свойства линий"
        helpText = "Изменить свойства выбранных линий:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите несколько тонких или штрихпунктирных линий"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2582
    def textEnglish(self):
        buttonText = "Вставить знак 'Ø'"
        helpText = "Вставить знак 'Ø' в размер:"+ "\n"\
                   "- выберите несколько размеров"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2705
    def textEnglish(self):
        buttonText = "Вставить знак '〼'"
        helpText = "Вставить знак '〼' в размер:"+ "\n"\
                   "- выберите несколько размеров"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2821
    def textEnglish(self):
        buttonText = "Группа ортогональных проекций: установка линии разреза"
        helpText = "Установить линию разреза на оси X или Y базового вида"+ "\n"\
                   "- выберите направление разреза"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------2956
    def textEnglish(self):
        buttonText = "Блокировать (разблокировать) вид
        helpText = "Блокировать (разблокировать) вид"+ "\n"\
                   "- выберите вид"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3068
    def textEnglish(self):
        buttonText = "Создать вертикальную цепь размеров"
        helpText = "- выберите не менее трех точек"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3186
    def textEnglish(self):
        buttonText = "Создать горизонтальную  цепь размеров"
        helpText = "- выберите не менее трех точек"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3308
    def textEnglish(self):
        buttonText = "Расположение вертикальной цепи размеров"
        helpText = "Располагает выбранные вертикальные размеры на одной линии:"+ "\n"\
                   "- выберите два и более размера"+"\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3426
    def textEnglish(self):
        buttonText = "Расположение вертикальной цепи размеров"
        helpText = "Располагает выбранные горизонтальные размеры на одной линии:"+ "\n"\
                   "- выберите два и более размера"+"\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3552
    def textEnglish(self):
        buttonText = "Вертикальные размеры"
        helpText = "Величина горизонтального интервала между выбранными размерами:"+ "\n"\
                   "- выберите величину интервала"+ "\n"\
                   "- выберите два и более вертикальных размера"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3685
    def textEnglish(self):
        buttonText = "Горизонтальные размеры"
        helpText = "Величина вертикального интервала между выбранными размерами:"+ "\n"\
                   "- выберите величину интервала"+ "\n"\
                   "- выберите две и более горизонтальных размера"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3811
    def textEnglish(self):
        buttonText = "Добавить разряд (max 9)"
        helpText = "Добавляет разряд:"+ "\n"\
                   "- выберите несколько размеров"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------3937
    def textEnglish(self):
        buttonText = "Убрать разряд"
        helpText = "Убирает разряд:"+ "\n"\
                   "- выберите несколько размеров"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------4058
    def textEnglish(self):
        buttonText = "Создать горизонтальные координатные размеры"
        helpText = "- выберите величину интервала"+ "\n"\
                   "- выберите три  и более точки"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------4184
    def textEnglish(self):
        buttonText = "Создать вертикальные координатные размеры"
        helpText = "- выберите величину интервала"+ "\n"\
                   "- выберите три  и более точки"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------4320
    def textEnglish(self):
        buttonText = "Горизонтальный размер фаски"
        helpText = "- выберите две точки"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------4441
    def textEnglish(self):
        buttonText = "Вертикальный размер фаски"
        helpText = "- выберите две точки"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------4558
    def textEnglish(self):
        buttonText = "Создать массив отверстий"
        helpText = "- выберите точку отсчета"+ "\n"\
                   "- выберите несколько отверстий"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------4743
    def textEnglish(self):
        buttonText = "Рисовать вспомогательную окружность (по центру и точке)"
        helpText = "Рисовать вспомогательную окружность по двум точкам:"+ "\n"\
                   "- выберите свойства линии:"+ "\n"\
                   "- укажите центральную точку) -> затем укажите вторую (радиус)"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------5019
    def textEnglish(self):
        buttonText = "Рисовать вспомогательную дугу (по центру и двум точкам)"
        helpText = "Рисовать дугу в положительном направлении:"+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите три точки:"+ "\n"\
                   "- центр, начало, конец"+ "\n"\
                   "- задайте радиус"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------5173
    def textEnglish(self):
        buttonText = "Продлить линию"
        helpText = "Продлить линию с обоих концов:"+ "\n"\
                   "- выберите одну тонкую или осевую линию"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------5288
    def textEnglish(self):
        buttonText = "Укоротить линию"
        helpText = "Укоротить линию с обоих концов:"+ "\n"\
                   "- выберите одну тонкую или осевую линию"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------5415
    def textEnglish(self):
        buttonText = "Создать развертку/длину дуги"
        helpText = "Укажите развертку / длину дуги с помощью символа '∩':"+ "\n"\
                   "- выберите одну дугу"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
-------------5545
    def textEnglish(self):
        buttonText = "Создать перпендикулярную линию"
        helpText = "Создать перпендикулярную линию через точку "+ "\n"\
                   "- выберите свойства линии"+ "\n"\
                   "- выберите одну линию"+ "\n"\
                   "- выберите одну точку"+ "\n"\
                   "- нажмите эту кнопку"
        return(buttonText,helpText)
I would like to preview a new version of your macro with this translation for testing and final editing of the translation.
With best regards.
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by M4x »

I've just discovered that I'm not able to add the dimension symbol to TechDraw_HorizontalExtentDimension. It works very well with TechDraw_HorizontalDimension.

TechDraw page
TechDraw page
Snip macro screenshot-1030aa.png (13.66 KiB) Viewed 5802 times

tree view
tree view
Snip macro screenshot-db7dd1.png (17.38 KiB) Viewed 5802 times


TechDrawTools v 0.4.4

Code: Select all

OS: Ubuntu 20.04.3 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.25943 (Git) AppImage
Build type: Release
Branch: master
Hash: a65464b722a846bd2999aa2fecdff1132b15b297
Python version: 3.9.7
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/United States (en_US)
Attachments
TDTools_Diameter_Symbol_DimExtent_M4x.FCStd
(17 KiB) Downloaded 99 times
domad
Veteran
Posts: 2052
Joined: Mon Jun 22, 2020 12:16 pm

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by domad »

M4x wrote: Tue Oct 19, 2021 8:18 pm ........
Hello
Open the macro in FC and look for the line (it should be 2643) starting with:

Code: Select all

def activated(self):
DiamSign ='Ø'
these are the lines that solve the problem, be careful not to change the line indents (indentation):

Code: Select all

if Elem.Object.TypeId == 'TechDraw::DrawViewDimExtent' or 'TechDraw::DrawViewDimension':
...
Elem.Object.FormatSpec = DiamSign+OldFormat
the updated function should look like this:

Code: Select all

def activated(self):
        DiamSign ='Ø'
        Sel = gui.Selection.getSelectionEx()
        for Elem in Sel:
            if Elem.Object.TypeId == 'TechDraw::DrawViewDimExtent' or 'TechDraw::DrawViewDimension':
                OldFormat = Elem.Object.FormatSpec
                Elem.Object.FormatSpec = DiamSign+OldFormat
make the same change with the tubular diameter symbol (it's the next function)
A greeting
Attachments
TDTools_Diameter_Symbol_DimExtent_M4x.gif
TDTools_Diameter_Symbol_DimExtent_M4x.gif (289.63 KiB) Viewed 5646 times
User avatar
M4x
Veteran
Posts: 1472
Joined: Sat Mar 11, 2017 9:23 am
Location: Germany

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by M4x »

That makes sense. Thank you!
domad
Veteran
Posts: 2052
Joined: Mon Jun 22, 2020 12:16 pm

Re: Macro version 4.2 multilanguage: helper tools to improve TechDraw documents.

Post by domad »

Greetings to the Community!
Since there have been several questions, here's how you can quote (with a little patience, but not a lot) a plane axonometry in TechDraw using the tools of the "TechDrawTools V-0.4.4 multilanguage" macro.
For those wishing to try their hand at completing the sizing, acquiring practicality, in attachment, the Basic_Part_Design_Tutorial.fcstd "(revised) file used as a base.
Attachments
Isometric_axonometry_dimensioning.png
Isometric_axonometry_dimensioning.png (193.29 KiB) Viewed 4113 times
Basic_Part_Design_Tutorial.fcstd
(139.48 KiB) Downloaded 90 times
axonometry_dimensioning.gif
axonometry_dimensioning.gif (880.94 KiB) Viewed 4113 times
Post Reply