[SOLVED] 〼 -> What does this symbol stand for?

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [SOLVED] 〼 -> What does this symbol stand for?

Post by Evgeniy »

It is probably better to use a combo box for these characters (at least). Or string of buttons for fast insert. But it's worth thinking about everything well.
It will not be possible to do it perfectly right away in any case

What characters are used in ISO?
Do specify the number of holes in the dimensions in ISO?
What special symbols used in ISO?

In GOST (perhaps this is an incomplete list):

Before dimension:
отв. Ø - Diameter with number of holes (5 отв. Ø35) = 5 holes with diameter 35 mm.
Ø - Diameter symbol
□ - Rectangle shape size (Rectangle symbol without line inside) (□ 30)
○ or ⭘- Sphere shape diameter (⭘ Ø32)
⊲ - Conic shape left to right (⊲ 1:5)
⊳ - Conic shape right to left
⦣ - Draft of surface (Symbol looks ugly, but I didn't find anything else in unicode) (⦣ 1:100 ; ⦣ 12% ; 5 ‰)
⦟ - Draft surface other direction.
° - grad may be used for angles

After dimension:
x 45° - for chamfer


I would like to note that osifont is a little unfinished and has errors.
Does the license allow us to modify this font?
Do we have the right to add beautiful symbols of these characters to this font? For example in Unicode Private Use Area.
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [SOLVED] 〼 -> What does this symbol stand for?

Post by Evgeniy »

My vision of this feature is insert from combobox selection:
Symbols.gif
Symbols.gif (461.76 KiB) Viewed 1886 times
Pyhthon scripts:
Macro.zip
(1.13 KiB) Downloaded 44 times
Inserter code logic (for example):
percent, grad and chamfer info, can be inserted at end of string.
other symbols can be inserted at start of string.

Code: Select all

   if "45" in sel:
      form.field.setText(form.field.text()+" "+sel)
   elif sel=="°" or sel=="‰":
      form.field.setText(form.field.text()+sel)   
   else:
      form.field.setText(sel+form.field.text())
Theoretically, all the characters combinations can be packed into a single string as:

Code: Select all

fmstr = "Ø*;□*;⭘*;⊲ *;⊳ *;⦣ *;⦟ *;*°; отв. Ø*;* x45°;*‰;"  
Last edited by Evgeniy on Thu Sep 23, 2021 7:56 am, edited 1 time in total.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: [SOLVED] 〼 -> What does this symbol stand for?

Post by chrisb »

Can you insert them at cursor position?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [SOLVED] 〼 -> What does this symbol stand for?

Post by Evgeniy »

This can be done, but the code will still be written in C and not in Python (not by me. Only if edi decides to do so). This is just a representation of how it can work.
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [SOLVED] 〼 -> What does this symbol stand for?

Post by Evgeniy »

Final version. What it might look like.

If the user has not clicked on the text field, the symbol is inserted either before or after the text (depending on the template).
If the user clicked on LineText, therefore he specified the cursor position, after that symbol will be inserted at the specified cursor position.
Symbols2.gif
Symbols2.gif (485.49 KiB) Viewed 1692 times
Macro3.zip
(1.48 KiB) Downloaded 37 times

Code: Select all

#! python
# -*- coding: utf-8 -*-
import os

focus = False;
def cur_pos_changed():
   global focus
   if form.field.hasFocus():
      focus = True; print("cursor position changed and focus on QLineText, this is mean user is click on QLineText")   

def cb_changed():
   global focus,symbol
   template = form.comboBox.currentText()
   item = form.comboBox.currentIndex()-1
   if item==-1:
      return    # If the user called an empty option, ignore it.
   index = form.field.cursorPosition()
   if focus:
      form.field.insert(template)   # if user set cursor position insert text to cursor position
   else:
      template = symbol[item]
      if "*" in template:
         form.field.setText(template.replace("*",form.field.text()))
      else:
         form.field.setCursorPosition(0)
         form.field.insert(template.replace("*",""))         
   form.comboBox.setCurrentIndex(0) #Reset index to zero! Otherwise, when you click again, event does not work.  
   
#form = FreeCADGui.PySideUic.loadUi(FreeCAD.getUserMacroDir()+"\Test.ui")
UiPath = os.path.join(os.path.dirname(os.path.abspath(__file__)),"Test.ui")
form = FreeCADGui.PySideUic.loadUi(UiPath)

# Add empty item at first
form.comboBox.addItem("")
# "*" is indicates where the value should be inserted
symbol_str = "Ø;□;⭘;⊲ ;⊳ ;⦣ ;⦟ ;*°; отв. Ø;* x45°;*‰"  
symbol = symbol_str.split(";")
for s in symbol:
   print(s,end=";")
   form.comboBox.addItem(s.replace("*","").strip())

form.comboBox.currentTextChanged.connect(cb_changed)
form.field.cursorPositionChanged.connect(cur_pos_changed)
form.show()
edi
Posts: 481
Joined: Fri Jan 17, 2020 1:32 pm

Re: [SOLVED] 〼 -> What does this symbol stand for?

Post by edi »

Very interesting suggestion, thank you @Evgeniy.

The main criterion is how the user is working.

I think, the most often situation is the following:
there are many, lets say 5 measures where you want to add a diameter sign. In TechDrawTools you select the 5 measures, then click the tool icon. You need 6 clicks. No window where you have to select anything.

TechDrawTools is programmed modular. You need only copy and paste to add more tools adding other letters.

In C++ the best user interface will be cascaded icons, like used at the "insert horizontal/vertical extended dimension" command. Many icons, each creating another letter, can be cascaded. Each icon will work like in TechDrawTools.
User avatar
Evgeniy
Posts: 477
Joined: Thu Jul 15, 2021 6:10 pm

Re: [SOLVED] 〼 -> What does this symbol stand for?

Post by Evgeniy »

In fact, instead of the digits "250" in QLineText, it should have been "%.0f" But I did not specify this point. It's easier to see.
edi wrote: Fri Sep 24, 2021 1:33 pm In C++ the best user interface will be cascaded icons, like used at the "insert horizontal/vertical extended dimension" command. Many icons, each creating another letter, can be cascaded. Each icon will work like in TechDrawTools.
If you tell about droppind list of command. I'm not sure that making a new button for each icon is a good idea.
But I'm not a developer, it's not up to me to decide.

As for the drop-down list of buttons, it seems to me like this:
Dimension list.png
Dimension list.png (28.55 KiB) Viewed 1612 times
However, probably no one will want to implement the GOST dimension type.
This is for the near future.
But in the distant future it will be possible to make separate sets of buttons for each standard.
Is one set of buttons for ISO, another for ASME, another for GOST, etc.
Drawing how it will look will take a lot of time, so I will not do this.
And in general, probably we need to create a separate topic about improve TechDraw.
Post Reply