Macro FCTreeView: Difference between revisions

From FreeCAD Documentation
(upgrade)
(Marked this version for translation)
(37 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages/>
{{Macro|Icon=Macro FCTreeView|Name=Macro FCTreeView|Description=This macro display all object of the project in one list with options sort search by name label...|Author=Mario52|Version=00.01 (08/09/2017)}}
<translate>
{{VeryImportantMessage|'''Do not Translate - Do not change - Page not finished''}}
<!--T:1-->
==Description==
{{Macro
Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label .... without case sensitive or with case sensitive and select all objects displayed in the macro window.
|Name=Macro FCTreeView
|Icon=Macro_FCTreeView.png
|Description={{ColoredText|#ff0000|#ffffff|New version GUI modifyed for the HD dpi (QGridLayout) run only FC version 0.18 and more (PySide2 Qt5)}} <br/> <br/>Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label .... without case sensitive or with case sensitive and select all objects displayed in the macro window. <br/> <br/>For the precedent version see [https://gist.githubusercontent.com/mario52a/67517ef758ff20005d0a6adcfd8c9190/raw/0a92d7f591a0a179f84b2fc417046723b4d7b0e6/Macro_FCTreeView.FCMacro Macro_FCTreeView.FCMacro] and install it manually.
|Author=Mario52
|Version=00.09
|Date=2020-09-24
|FCVersion=0.18 and below
|Download=[https://forum.freecadweb.org/download/file.php?id=70498 Macro FCTreeView Icon package] unzip the .zip file and copy the icon in your macro directory.
}}


==Description== <!--T:2-->
==How To Use==


<!--T:3-->
[[File:Macro FCTreeView 000.png|Macro FCTreeView]]
Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label .... without case sensitive or with case sensitive and select all objects displayed in the macro window.
</translate>
{{Codeextralink|https://gist.githubusercontent.com/mario52a/67517ef758ff20005d0a6adcfd8c9190/raw/59bc2028978c82744c83c6b138ab3ef30e0bf6f3/Macro_FCTreeView.FCMacro}}
<translate>
==How To Use== <!--T:4-->

<!--T:73-->
[[File:FCTreeView.gif |Macro FCTreeView]]
{{clear}}
{{clear}}


===Section '''Window'''===


===Section '''Window'''=== <!--T:5-->

<!--T:6-->
The title display the option, number and type object(s) displayed
The title display the option, number and type object(s) displayed


<!--T:7-->
*'''O''' = Original
*'''O''' = Objects
*'''N''' = Name
*'''N''' = Name
*'''L''' = Label
*'''L''' = Label
Line 22: Line 42:
*'''H''' = Hidden
*'''H''' = Hidden
If one object are selected : the Placement Base, Rotation and Center of mass is displayed (if available !)
If one object are selected : the Placement Base, Rotation and Center of mass is displayed (if available !)
</translate>

<translate>
<!--T:8-->
[[File:Macro FCTreeView 00.png|Icon used for the Name of object]] Icon used for the Name of object (the scrollbar is colored blue)
[[File:Macro FCTreeView 00.png|Icon used for the Name of object]] Icon used for the Name of object (the scrollbar is colored blue)


<!--T:9-->
[[File:Macro FCTreeView 05.png|Icon used for the Label of object]] Icon used for the Label of object (the scrollbar is colored blue clear)
[[File:Macro FCTreeView 05.png|Icon used for the Label of object]] Icon used for the Label of object (the scrollbar is colored blue clear)


<!--T:10-->
[[File:Macro FCTreeView 01.png|Icon used for visualise if the object is status Visible (mouse click for Hidden)]] Icon used for visualise if the object is status Visible (mouse click for Hidden) (the scrollbar is colored green)
[[File:Macro FCTreeView 01.png|Icon used for visualise if the object is status Visible (mouse click for Hidden)]] Icon used for visualise if the object is status Visible (mouse click for Hidden) (the scrollbar is colored green)


<!--T:11-->
[[File:Macro FCTreeView 02.png|Icon used for visualise if the object is status Hidden (mouse click for Visible)]] Icon used for visualise if the object is status Hidden (mouse click for Visible) (the scrollbar is colored red)
[[File:Macro FCTreeView 02.png|Icon used for visualise if the object is status Hidden (mouse click for Visible)]] Icon used for visualise if the object is status Hidden (mouse click for Visible) (the scrollbar is colored red)


<!--T:12-->
[[File:Macro FCTreeView 17.png|Icon used for the Name contains objects (or folder Group)]] Icon used for the Name contains objects (or folder Group)
[[File:Macro FCTreeView 17.png|Icon used for the Name contains objects (or folder Group)]] Icon used for the Name contains objects (or folder Group)


<!--T:13-->
[[File:Macro FCTreeView 03.png|Icon used for inform the object in a group the number objects is displayed in top group]] Icon used for inform the object in a group the number objects is displayed in top group (the scrollbar is colored red clear)
[[File:Macro FCTreeView 03.png|Icon used for inform the object in a group the number objects is displayed in top group]] Icon used for inform the object in a group the number objects is displayed in top group (the scrollbar is colored red clear)


<!--T:14-->
[[File:Macro FCTreeView 04.png|Icon used for displayed the single object (not group)]] Icon used for displayed the single object (not group)
[[File:Macro FCTreeView 04.png|Icon used for displayed the single object (not group)]] Icon used for displayed the single object (not group)
</translate>

<translate>
===Section '''Sort by :'''===
===Section '''Sort by :'''=== <!--T:15-->

</translate>
<translate>
<!--T:16-->
{{KEY|[[File:Macro FCTreeView 10.png|18px]] Name}} Icon used for flip/flop normal/reverse the data listing sort by Name
{{KEY|[[File:Macro FCTreeView 10.png|18px]] Name}} Icon used for flip/flop normal/reverse the data listing sort by Name


<!--T:17-->
{{KEY|[[File:Macro FCTreeView 11.png|18px]] Label}} Icon used for flip/flop normal/reverse the data listing sort by Label
{{KEY|[[File:Macro FCTreeView 11.png|18px]] Label}} Icon used for flip/flop normal/reverse the data listing sort by Label


<!--T:18-->
{{KEY|[[File:Macro FCTreeView 12.png|18px]] Visible}} Icon used for flip/flop normal/reverse the data listing sort by Visibile/Hidden
{{KEY|[[File:Macro FCTreeView 12.png|18px]] Visible}} Icon used for flip/flop normal/reverse the data listing sort by Visibile/Hidden


<!--T:19-->
{{KEY|[[File:Macro FCTreeView 13.png|18px]] Group}} Icon used for flip/flop normal/reverse the data listing sort by Group/Single object
{{KEY|[[File:Macro FCTreeView 13.png|18px]] Group}} Icon used for flip/flop normal/reverse the data listing sort by Group/Single object


<!--T:20-->
{{KEY|[[File:Macro FCTreeView 19.png|18px]] Length}} If this check Box is checked the sort is created by length with the button clicked (Name, Label ...)
{{KEY|[[File:Macro FCTreeView 19.png|18px]] Length}} If this check Box is checked the sort is created by length with the button clicked (Name, Label ...)
</translate>

<translate>
===Section '''Global'''===
===Section '''Global'''=== <!--T:21-->

</translate>
<translate>
<!--T:22-->
{{KEY|[[File:Macro FCTreeView 21.png|18px]] Split}} flip/flop Split the Name list
{{KEY|[[File:Macro FCTreeView 21.png|18px]] Split}} flip/flop Split the Name list


<!--T:23-->
{{KEY|[[File:Macro FCTreeView 22.png|18px]] Split}} flip/flop Split the Name and Label list
{{KEY|[[File:Macro FCTreeView 22.png|18px]] Split}} flip/flop Split the Name and Label list


<!--T:24-->
{{KEY|[[File:Macro FCTreeView 14.png|18px]] Expend}} flip/flop the data listing Fold/Expend
{{KEY|[[File:Macro FCTreeView 14.png|18px]] Expend}} flip/flop the data listing Fold/Expend


<!--T:25-->
{{KEY|[[File:Macro FCTreeView 15.png|18px]] Expend}} flip/flop the data listing Expend/Fold
{{KEY|[[File:Macro FCTreeView 15.png|18px]] Expend}} flip/flop the data listing Expend/Fold


<!--T:26-->
{{KEY|[[File:Macro FCTreeView 06.png|18px]] Visibility}} flip/flop normal/Visibility
{{KEY|[[File:Macro FCTreeView 06.png|18px]] Visibility}} flip/flop normal/Visibility


<!--T:27-->
{{KEY|[[File:Macro FCTreeView 07.png|18px]] Group}} flip/flop normal/Group
{{KEY|[[File:Macro FCTreeView 07.png|18px]] Group}} flip/flop normal/Group


<!--T:28-->
{{KEY|[[File:Macro FCTreeView 16.png|18px]] Reload}} reload the data in the project
{{KEY|[[File:Macro FCTreeView 16.png|18px]] Reload}} reload the data in the project


<!--T:29-->
{{KEY|[[File:Macro FCTreeView 18.png|18px]] Original}} return in original organisation after operation visibility/Hidden
{{KEY|[[File:Macro FCTreeView 18.png|18px]] Original}} return in original organisation after operation visibility/Hidden


<!--T:30-->
{{KEY|[[File:Macro FCTreeView 01.png|18px]] All Visible}} visualise if the object is status Visible
{{KEY|[[File:Macro FCTreeView 01.png|18px]] All Visible}} visualise if the object is status Visible


<!--T:31-->
{{KEY|[[File:Macro FCTreeView 02.png|18px]] All Hidden}} visualise if the object is status Hidden
{{KEY|[[File:Macro FCTreeView 02.png|18px]] All Hidden}} visualise if the object is status Hidden
</translate>

<translate>
===Section '''Search'''===
===Section '''Search'''=== <!--T:32-->

</translate>
<translate>
<!--T:33-->
{{KEY|[[File:Macro FCTreeView 20.png|18px]] Clear}} Clear the search line edit
{{KEY|[[File:Macro FCTreeView 20.png|18px]] Clear}} Clear the search line edit
</translate>

<translate>
====The radioButton options '''Search''':====
====The radioButton options '''Search''':==== <!--T:34-->

</translate>
<translate>
<!--T:35-->
*'''("NLwc")''' : Search by Name and Label '''W'''ithout respecting the sensitive '''C'''ase
*'''("NLwc")''' : Search by Name and Label '''W'''ithout respecting the sensitive '''C'''ase


<!--T:36-->
*'''("Nsc")''' : Search by Name and respecting the '''S'''ensitive '''C'''ase
*'''("Nsc")''' : Search by Name and respecting the '''S'''ensitive '''C'''ase


<!--T:37-->
*'''("Lwc")''' : Search by Label '''W'''ithout respecting the sensitive '''C'''ase
*'''("Lwc")''' : Search by Label '''W'''ithout respecting the sensitive '''C'''ase


<!--T:38-->
*'''("NLsc")''' : Search by Name and Label and respecting the '''S'''ensitive '''C'''ase
*'''("NLsc")''' : Search by Name and Label and respecting the '''S'''ensitive '''C'''ase


<!--T:39-->
*'''("NLwsc")''' : Search by Name and Label in Word and respecting the '''S'''ensitive '''C'''ase (same panel selection of FreeCAD)
*'''("NLwsc")''' : Search by Name and Label in Word and respecting the '''S'''ensitive '''C'''ase (same panel selection of FreeCAD)


<!--T:53-->
*'''(Nu)''' : Search by numeric value (radius, length, angle .....) see version section

<!--T:40-->
{{KEY|[[File:Macro FCTreeView 23.png|18px]] Select}} flip/flop for Selected all object(s) displayed in the window
{{KEY|[[File:Macro FCTreeView 23.png|18px]] Select}} flip/flop for Selected all object(s) displayed in the window


<!--T:41-->
{{KEY|[[File:Macro FCTreeView 24.png|18px]] Unselected}} flip/flop Unselected all object(s)
{{KEY|[[File:Macro FCTreeView 24.png|18px]] Unselected}} flip/flop Unselected all object(s)


<!--T:56-->
===Icons===
{{KEY|[[File:Macro FCTreeView 25.png|18px]] S Sheet}} access in Spreadsheet options

</translate>
<translate>
===The SpreadSheet options:=== <!--T:57-->
</translate>

[[File:TreeView_SpeadSheet.gif |Macro FCTreeView]]
{{clear}}

<translate>
<!--T:58-->
[[File:Macro FCTreeView 001.png]]

<!--T:59-->
[[File:Macro FCTreeView 002.png]]
* CheckBox options for select the data to save in spreadsheet

<!--T:70-->
{{KEY|[[File:Macro FCTreeView 28.png|18px]] Select}} : Select all checkBox option to save

<!--T:71-->
{{KEY|[[File:Macro FCTreeView 29.png|18px]] Select}} : unSelect all checkBox option to save

<!--T:60-->
[[File:Macro FCTreeView 003.png]]
* '''Value''' : alone the value is saved in the cell
** Ex : 10.00 [[File:Macro FCTreeView 30.png]]
* '''Val Gr''' : the value and the unit are saved in unique cell
** Ex : 10.00 mm [[File:Macro FCTreeView 31.png]]
* '''Val Gr Ph''' : the value, the unit and the physic data is saved in unique cell
** Ex : 10.00 mm Length [[File:Macro FCTreeView 32.png]]
* '''Split''' : if the Split checkBox is checked, the data is cut saved in separate cell
** Ex : 10.00 | mm | length [[File:Macro FCTreeView 33.png]]

<!--T:61-->
[[File:Macro FCTreeView 004.png]]
* Combobox '''mm''' : select the unit length desired. The value is convert in the selected unit. The units length available are:
** km, hm, dam, m, dm, cm, '''mm''', um, nm, pm, fm, in, lk, ft, yd, rd, ch, fur, mi, lea, nmi
* Combobox '''gram''' : select the unit weight desired. The value is convert in the selected unit. The units weight available are:
** t, q, kg, hg, dag, '''g''', dg, cg, mg, µg, ng, pg, fg, gr, dr, oz, oz t, lb, t lb, st, qtr, cwt, tonneau fr, ct
* Spinbox '''Densite''' : give the density by dm3 of the material used (Default : 1.0000)
* Spinbox '''Round''' : give the round value desired (Default : 3)

<!--T:62-->
[[File:Macro FCTreeView 005.png]]
* Combobox '''Name spreadSheet''' : List the spreadsheet in the document
* Line edit '''Name spreadSheet''' : Display the actual spreadsheet or give the name for the new spreadsheet

<!--T:63-->
[[File:Macro FCTreeView 006.png]]

<!--T:64-->
{{KEY|[[File:Macro FCTreeView 28.png|18px]] Select}} select all checkbox options


<!--T:65-->
{{KEY|[[File:Macro FCTreeView 29.png|18px]] Unselect}} unselected all checkbox options

<!--T:66-->
{{KEY|[[File:Macro FCTreeView 27.png|18px]] Save}} save the data in Spreadsheet displayed. if no spreadsheet is active the spreadsheet named '''FCSpreadSheet''' is created

<!--T:67-->
{{KEY|[[File:Macro FCTreeView 26.png|18px]] Quit}} quit the Spreadsheet options

</translate>
<translate>
===Icons=== <!--T:42-->
</translate>
<translate>
<!--T:43-->
The icon must be copied into the same directory as the macro
The icon must be copied into the same directory as the macro
</translate>
[https://forum.freecadweb.org/download/file.php?id=70498 Macro_FCTreeView_Icon]


[[File:Macro FCTreeView 00.png|Icon used for the Name of object]] [[File:Macro FCTreeView 01.png|Icon used for visualise if the object is status Visible (mouse click for Hidden)]]
[[File:Macro FCTreeView 00.png|Icon used for the Name of object]] [[File:Macro FCTreeView 01.png|Icon used for visualise if the object is status Visible (mouse click for Hidden)]]
Line 119: Line 252:
[[File:Macro FCTreeView 23.png|Icon used for Selected all object(s) displayed in the window]]
[[File:Macro FCTreeView 23.png|Icon used for Selected all object(s) displayed in the window]]
[[File:Macro FCTreeView 24.png|Icon used for Unselected all object(s)]]
[[File:Macro FCTreeView 24.png|Icon used for Unselected all object(s)]]
[[File:Macro FCTreeView 25.png|Icon used for access in Spreadsheet options]]
[[File:Macro FCTreeView 26.png|Icon used for quit the Spreadsheet options]]
[[File:Macro FCTreeView 27.png|Icon used for save the data in Spreadsheet]]
[[File:Macro FCTreeView 28.png|Icon used for select all checkbox options]]
[[File:Macro FCTreeView 29.png|Icon used for unselected all checkbox options]]
[[File:Macro FCTreeView 30.png|Icon used for save the value data in Spreadsheet]]
[[File:Macro FCTreeView 31.png|Icon used for save the value and Unit data in Spreadsheet]]
[[File:Macro FCTreeView 32.png|Icon used for save the value, Unit and type data in Spreadsheet]]
[[File:Macro FCTreeView 33.png|Icon used for split the value, Unit and type in cell separate in Spreadsheet]]


<translate>
==Script==
==Script== <!--T:44-->
The icon ToolBar [[File:Macro FCTreeView.png|Macro FCTreeView]]


<!--T:49-->
'''Macro FCTreeView.FCMacro'''
For prevent many instance the clic on ToolBar button are effect flip/flop (hide/visible)
{{Code|code=
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
#
"""
***************************************************************************
* Copyright (c) 2017 <mario52> *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License (LGPL) *
* as published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* for detail see the LICENCE text file. *
* *
* This software is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this macro; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
***************************************************************************
* WARNING! All changes in this file will be lost and *
* may cause malfunction of the program *
***************************************************************************
"""
#Macro_ 29/08/2017 /_00
#
#OS: Windows 10
#Word size of OS: 64-bit
#Word size of FreeCAD: 64-bit
#Version: 0.16.6706 (Git)
#Build type: Release
#Branch: releases/FreeCAD-0-16
#Hash: f86a4e411ff7848dea98d7242f43b7774bee8fa0
#Python version: 2.7.8
#Qt version: 4.8.7
#Coin version: 4.0.0a
#OCC version: 6.8.0.oce-0.17
#
__title__ = "Macro_FCTreeView"
__author__ = "Mario52"
__url__ = "http://www.freecadweb.org/index-fr.html"
__Wiki__ = "http://www.freecadweb.org/wiki/index.php?title=Macro_FCTreeView"
__version__ = "00.01"
__date__ = "08/09/2017"


<!--T:50-->
import PySide
The macro is located in right dock for change it modify the value line number 133 '''testing = 0''' (or change it with the mouse as a widget normal)
from PySide import QtGui ,QtCore
</translate>
from PySide.QtGui import *
from PySide.QtCore import *
import time
from pivy import coin


The icon ToolBar [[File:Macro FCTreeView.png|Macro FCTreeView]]
from PySide import QtSvg, QtXml
import copy
import operator
from operator import itemgetter, attrgetter, methodcaller


'''Macro_FCTreeView.FCMacro'''
####
from PySide import QtCore
#global langue
#s=QtCore.QLocale()
#s.countryToString(s.country())
#s.name()
#langue = s.languageToString(s.language())
#print s.name() # fr
#print langue # French
####


{{CodeDownload|https://gist.github.com/mario52a/67517ef758ff20005d0a6adcfd8c9190|Macro_FCTreeView.FCMacro}}
import time


<translate>
Gui = FreeCADGui
==To do== <!--T:45-->
App = FreeCAD
</translate>
<translate>
<!--T:46-->
<strike>Docked the macro</strike>
</translate>
<translate>
==Version== <!--T:47-->


<!--T:76-->
global ui ; ui = ""
ver 00.09 (2020-09-24) : correct the "'''freeze'''" macro after call the '''assembly4 workbench''' i try activate "'''Class SelObserver'''" and it work ???
global doc ; doc = ""
global sourisPass ; sourisPass = 0
global listeObjetsOriginal ; listeObjetsOriginal = [[]] # Name, objLabel, "False", objGroupe, objLName, objLLabel, objLGroupe, objSignal
global listeSorted ; listeSorted = [[]] # Name, objLabel, "False", objGroupe, objLName, objLLabel, objLGroupe, objSignal
global listeByStringSear ; listeByStringSear = [] # object searched
global titre ; titre = " Original"
global derouler ; derouler = 0
global visibilite ; visibilite = 0
global group ; group = 0
global searchString ; searchString = ""
global SplitNameLabel ; SplitNameLabel = 0
global selections ; selections = 0


</translate>
global reverse_00 ; reverse_00 = 0
{{Code|code=
global reverse_01 ; reverse_01 = 0
class SelObserver:
global reverse_02 ; reverse_02 = 0
def addSelection(self, document, object, element, position): # Selection
global reverse_03 ; reverse_03 = 0
global sourisPass

try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s

try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):

def __init__(self, MainWindow):

self.window = MainWindow
#############
#self.path = FreeCAD.ConfigGet("AppHomePath")
#self.path = FreeCAD.ConfigGet("UserAppData")
#self.path = "your path"
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro") # macro path
self.path = param.GetString("MacroPath","") + "/" # macro path
self.path = self.path.replace("\\","/")
# print "Path for the icons : " , self.path
#############

self.iconName = QtGui.QIcon(self.path + "Macro_FCTreeView_00.png")
self.iconTrue = QtGui.QIcon(self.path + "Macro_FCTreeView_01.png")
self.iconFalse = QtGui.QIcon(self.path + "Macro_FCTreeView_02.png")
self.iconChain = QtGui.QIcon(self.path + "Macro_FCTreeView_03.png")
self.iconChainCut = QtGui.QIcon(self.path + "Macro_FCTreeView_04.png")
self.iconLabel = QtGui.QIcon(self.path + "Macro_FCTreeView_05.png")
self.iconVisible = QtGui.QIcon(self.path + "Macro_FCTreeView_06.png")
self.iconPaChain = QtGui.QIcon(self.path + "Macro_FCTreeView_07.png")
self.iconFolder = QtGui.QIcon(self.path + "Macro_FCTreeView_17.png")

# self.vueActive = FreeCADGui.ActiveDocument.ActiveView
# self.click = self.vueActive.addEventCallback("SoMouseButtonEvent",self.souris)
#
# def souris(self,info):
# global sourisPass
# print "ok2"
# ##{'ShiftDown': False, 'Button': 'BUTTON1', 'CtrlDown': False, 'State': 'UP', 'Time': 'Sunday, July 23, 2017 21:43:39', 'Position': (479, 354), 'AltDown': False, 'Type': 'SoMouseButtonEvent'}
# if (info["Button"] == "BUTTON1") and (info["State"] == "DOWN"):
# sourisPass = 0
## print "ok3"

def setupUi(self, MainWindow):
self.window = MainWindow

MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(341, 624)
MainWindow.setMinimumSize(QtCore.QSize(341,624))
MainWindow.setMaximumSize(QtCore.QSize(341,624))
MainWindow.move(950, 120) # deplace la fenetre
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))

##########
self.fontGlobal_08 = QtGui.QFont() # pour compatibilite Windows Linux pour tous les textes
self.fontGlobal_08.setFamily("Arial") # pour compatibilite Windows Linux pour tous les textes
self.fontGlobal_08.setPointSize(8.0) # pour compatibilite Windows Linux pour tous les textes
#self.xxxxx.setFont(self.fontGlobal_08) # pour compatibilite W L
##########

self.treeWidget = QtGui.QTreeWidget(self.centralwidget)
self.treeWidget.setGeometry(QtCore.QRect(10, 10, 321, 400))
#self.treeWidget.setSortingEnabled(True) #sort by clicked title
#__sortingEnabled = self.treeWidget.isSortingEnabled() #sort by clicked title
#self.treeWidget.setSortingEnabled(__sortingEnabled) #sort by clicked title
#self.treeWidget.header().setSortIndicatorShown(True) #sort by clicked title
self.treeWidget.setMaximumSize(QtCore.QSize(600, 600))
self.treeWidget.setObjectName(_fromUtf8("treeWidget"))
self.treeWidget.setLineWidth(6)
self.treeWidget.setFont(self.fontGlobal_08) # pour compatibilite W L
self.treeWidget.setDefaultDropAction(QtCore.Qt.CopyAction)
self.treeWidget.setAlternatingRowColors(True)
self.treeWidget.setIconSize(QtCore.QSize(12, 12)) # icon dimensions
self.treeWidget.setAnimated(True)
self.treeWidget.header().sectionSize(1200)
self.treeWidget.header().setDefaultSectionSize(1200)
self.treeWidget.header().setMinimumSectionSize(1200) # dimension fenetre interne
self.treeWidget.header().setCascadingSectionResizes(True)
self.treeWidget.header().setHighlightSections(True)
self.treeWidget.header().setStretchLastSection(True)
self.treeWidget.header().setMovable(True)
self.treeWidget.clicked.connect(self.on_treeWidget_clicked) # connect on_treeWidget_clicked


self.groupBox_Sort = QtGui.QGroupBox(self.centralwidget)
self.groupBox_Sort.setGeometry(QtCore.QRect(10, 420, 321, 46))
self.groupBox_Sort.setObjectName(_fromUtf8("groupBox_Sort"))

self.PB_Sort_00 = QtGui.QPushButton(self.groupBox_Sort)
self.PB_Sort_00.setGeometry(QtCore.QRect(5, 15, 58, 23))
self.PB_Sort_00.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_10.png"))
self.PB_Sort_00.setFont(self.fontGlobal_08)
self.PB_Sort_00.setObjectName(_fromUtf8("PB_Sort_00"))
self.PB_Sort_00.clicked.connect(self.on_PB_Sort_00_clicked)

self.PB_Sort_01 = QtGui.QPushButton(self.groupBox_Sort)
self.PB_Sort_01.setGeometry(QtCore.QRect(66, 15, 58, 23))
self.PB_Sort_01.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_11.png"))
self.PB_Sort_01.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Sort_01.setObjectName(_fromUtf8("PB_Quit"))
self.PB_Sort_01.clicked.connect(self.on_PB_Sort_01_clicked)

self.PB_Sort_02 = QtGui.QPushButton(self.groupBox_Sort)
self.PB_Sort_02.setGeometry(QtCore.QRect(126, 15, 58, 23))
self.PB_Sort_02.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_12.png"))
self.PB_Sort_02.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Sort_02.setObjectName(_fromUtf8("PB_Sort_02"))
self.PB_Sort_02.clicked.connect(self.on_PB_Sort_02_clicked)

self.PB_Sort_03 = QtGui.QPushButton(self.groupBox_Sort)
self.PB_Sort_03.setGeometry(QtCore.QRect(187, 15, 58, 23))
self.PB_Sort_03.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_13.png"))
self.PB_Sort_03.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Sort_03.setObjectName(_fromUtf8("PB_Sort_03"))
self.PB_Sort_03.clicked.connect(self.on_PB_Sort_03_clicked)

self.CB_Length = QtGui.QCheckBox(self.groupBox_Sort)
self.CB_Length.setGeometry(QtCore.QRect(248, 19, 110, 20))
self.CB_Length.setObjectName(_fromUtf8("CB_Length"))
self.CB_Length.setFont(self.fontGlobal_08) # pour compatibilite W L
self.CB_Length.setChecked(False)
self.CB_Length.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_19.png"))


self.groupBox_Global = QtGui.QGroupBox(self.centralwidget)
self.groupBox_Global.setGeometry(QtCore.QRect(10, 470, 321, 71))
self.groupBox_Global.setObjectName(_fromUtf8("groupBox_Global"))

# self.PB_Reverse = QtGui.QPushButton(self.groupBox_Global)
# self.PB_Reverse.setGeometry(QtCore.QRect(5, 15, 75, 23))
# self.PB_Reverse.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_08.png"))
# self.PB_Reverse.setFont(self.fontGlobal_08) # pour compatibilite W L
# self.PB_Reverse.setObjectName(_fromUtf8("PB_Reverse"))
# self.PB_Reverse.clicked.connect(self.on_PB_Reverse_clicked)

self.PB_SplitName = QtGui.QPushButton(self.groupBox_Global)
self.PB_SplitName.setGeometry(QtCore.QRect(5, 15, 75, 23))
self.PB_SplitName.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_22.png"))
self.PB_SplitName.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_SplitName.setObjectName(_fromUtf8("PB_SplitName"))
self.PB_SplitName.clicked.connect(self.on_PB_SplitName_clicked)

self.PB_Expend = QtGui.QPushButton(self.groupBox_Global)
self.PB_Expend.setGeometry(QtCore.QRect(84, 15, 75, 23))
self.PB_Expend.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_15.png"))
self.PB_Expend.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Expend.setObjectName(_fromUtf8("PB_Expend"))
self.PB_Expend.clicked.connect(self.on_PB_Expend_clicked)

self.PB_Visibility = QtGui.QPushButton(self.groupBox_Global)
self.PB_Visibility.setGeometry(QtCore.QRect(162, 15, 75, 23))
self.PB_Visibility.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_06.png"))
self.PB_Visibility.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Visibility.setObjectName(_fromUtf8("PB_Visibility"))
self.PB_Visibility.clicked.connect(self.on_PB_Visibility_clicked)

self.PB_Group = QtGui.QPushButton(self.groupBox_Global)
self.PB_Group.setGeometry(QtCore.QRect(241, 15, 75, 23))
self.PB_Group.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_07.png"))
self.PB_Group.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Group.setObjectName(_fromUtf8("PB_Group"))
self.PB_Group.clicked.connect(self.on_PB_Group_clicked)

self.PB_Reload = QtGui.QPushButton(self.groupBox_Global)
self.PB_Reload.setGeometry(QtCore.QRect(5, 40, 75, 23))
self.PB_Reload.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_16.png"))
self.PB_Reload.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Reload.setObjectName(_fromUtf8("PB_Reload"))
self.PB_Reload.clicked.connect(self.on_PB_Reload_clicked)

self.PB_Original = QtGui.QPushButton(self.groupBox_Global)
self.PB_Original.setGeometry(QtCore.QRect(84, 40, 75, 23))
self.PB_Original.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_18.png"))
self.PB_Original.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Original.setObjectName(_fromUtf8("PB_Original"))
self.PB_Original.clicked.connect(self.on_PB_Original_clicked)

self.PB_All_Visible = QtGui.QPushButton(self.groupBox_Global)
self.PB_All_Visible.setGeometry(QtCore.QRect(162, 40, 75, 23))
self.PB_All_Visible.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_01.png"))
self.PB_All_Visible.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_All_Visible.setObjectName(_fromUtf8("PB_All_Visible"))
self.PB_All_Visible.clicked.connect(self.on_PB_All_Visible_clicked)

self.PB_All_Hidden = QtGui.QPushButton(self.groupBox_Global)
self.PB_All_Hidden.setGeometry(QtCore.QRect(241, 40, 75, 23))
self.PB_All_Hidden.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_02.png"))
self.PB_All_Hidden.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_All_Hidden.setObjectName(_fromUtf8("PB_Original"))
self.PB_All_Hidden.clicked.connect(self.on_PB_All_Hidden_clicked)


self.groupBox_Search = QtGui.QGroupBox(self.centralwidget)
self.groupBox_Search.setGeometry(QtCore.QRect(10, 544, 321, 71))
self.groupBox_Search.setObjectName(_fromUtf8("groupBox_Search"))

self.lineEdit_Search = QtGui.QLineEdit(self.groupBox_Search)
self.lineEdit_Search.setGeometry(QtCore.QRect(5, 15, 231, 21))
self.lineEdit_Search.setFont(self.fontGlobal_08) # pour compatibilite W L
self.lineEdit_Search.setObjectName(_fromUtf8("lineEdit_Search"))
# self.lineEdit_Search.returnPressed.connect(self.on_lineEdit_Search_Pressed) # for validate the data with press on return touch
self.lineEdit_Search.textChanged.connect(self.on_lineEdit_Search_Pressed) # with tips key char by char

self.PB_ClearLEdit = QtGui.QPushButton(self.groupBox_Search)
self.PB_ClearLEdit.setGeometry(QtCore.QRect(240, 14, 75, 23))
self.PB_ClearLEdit.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_ClearLEdit.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_20.png"))
self.PB_ClearLEdit.setObjectName(_fromUtf8("PB_ClearLEdit"))
self.PB_ClearLEdit.clicked.connect(self.on_PB_ClearLEdit_clicked)

self.frame_Options = QtGui.QFrame(self.groupBox_Search)
self.frame_Options.setGeometry(QtCore.QRect(5, 40, 231, 23))
self.frame_Options.setFrameShape(QtGui.QFrame.StyledPanel)
self.frame_Options.setFrameShadow(QtGui.QFrame.Plain)
self.frame_Options.setObjectName(_fromUtf8("frame_Options"))

self.RB_01_NameLabel = QtGui.QRadioButton(self.frame_Options)
self.RB_01_NameLabel.setGeometry(QtCore.QRect(5, 4, 43, 17))
self.RB_01_NameLabel.setObjectName(_fromUtf8("RB_01_NameLabel"))
self.RB_01_NameLabel.setChecked(True)
self.RB_01_NameLabel.clicked.connect(self.on_RB_Pressed)

self.RB_02_Name_CS = QtGui.QRadioButton(self.frame_Options)
self.RB_02_Name_CS.setGeometry(QtCore.QRect(50, 4, 43, 17))
self.RB_02_Name_CS.setObjectName(_fromUtf8("RB_02_Name_CS"))
self.RB_02_Name_CS.clicked.connect(self.on_RB_Pressed)

self.RB_03_Label_NC = QtGui.QRadioButton(self.frame_Options)
self.RB_03_Label_NC.setGeometry(QtCore.QRect(94, 4, 40, 17))
self.RB_03_Label_NC.setObjectName(_fromUtf8("RB_03_Label_NC"))
self.RB_03_Label_NC.clicked.connect(self.on_RB_Pressed)

self.RB_04_NamLabel_CS = QtGui.QRadioButton(self.frame_Options)
self.RB_04_NamLabel_CS.setGeometry(QtCore.QRect(134, 4, 43, 17))
self.RB_04_NamLabel_CS.setObjectName(_fromUtf8("RB_04_NamLabel_CS"))
self.RB_04_NamLabel_CS.clicked.connect(self.on_RB_Pressed)

self.RB_05_NameLabel_AL = QtGui.QRadioButton(self.frame_Options)
self.RB_05_NameLabel_AL.setGeometry(QtCore.QRect(179, 4, 50, 17))
self.RB_05_NameLabel_AL.setObjectName(_fromUtf8("RB_05_NameLabel_AL"))
self.RB_05_NameLabel_AL.clicked.connect(self.on_RB_Pressed)

# self.PB_Quit = QtGui.QPushButton(self.centralwidget)
# self.PB_Quit.setGeometry(QtCore.QRect(251, 570, 75, 23))
# self.PB_Quit.setFont(self.fontGlobal_08) # pour compatibilite W L
# self.PB_Quit.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_09.png"))
# self.PB_Quit.setObjectName(_fromUtf8("PB_Quit"))
# self.PB_Quit.clicked.connect(self.on_PB_Quit_clicked)
#
self.PB_Select = QtGui.QPushButton(self.groupBox_Search)
self.PB_Select.setGeometry(QtCore.QRect(240, 40, 75, 23))
self.PB_Select.setFont(self.fontGlobal_08) # pour compatibilite W L
self.PB_Select.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_23.png"))
self.PB_Select.setObjectName(_fromUtf8("PB_Select"))
self.PB_Select.clicked.connect(self.on_PB_Select_clicked)

MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle("FCTreeView (" + __version__ + " (" + __date__ + "))")
MainWindow.setWindowIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_18.png")) # change l'icone de la fenetre principale
MainWindow.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint) # PySide cette fonction met la fenetre en avant

self.treeWidget.setToolTip("The title display the option, number and type object(s) displayed" + "\n" + "\n"
"O = Original" + "\n"
"N = Name" + "\n"
"L = Label" + "\n"
"T = Total" + "\n"
"G = Group" + "\n"
"S = Single" + "\n"
"V = Visible" + "\n"
"H = Hidden" + "\n\n"
"If one object are selected :" + "\n"
"the Placement Base, Rotation and Center of mass is displayed" + "\n"
"if available !")

self.groupBox_Sort.setTitle("Sort by:")
self.PB_Sort_00.setText("Name")
self.PB_Sort_00.setToolTip("<img src=" + self.path + "Macro_FCTreeView_10.png" + " />" + "\n"
"Sort by <b>Name</b>")
self.PB_Sort_01.setText("Label")
self.PB_Sort_01.setToolTip("<img src=" + self.path + "Macro_FCTreeView_11.png" + " />" + "\n"
"Sort by <b>Label</b>")
self.PB_Sort_02.setText("Visible")
self.PB_Sort_02.setToolTip("<img src=" + self.path + "Macro_FCTreeView_12.png" + " />" + "\n"
"Sort by <b>Visibility</b>")
self.PB_Sort_03.setText("Group")
self.PB_Sort_03.setToolTip("<img src=" + self.path + "Macro_FCTreeView_13.png" + " />" + "\n"
"Sort by <b>Group</b>")
self.CB_Length.setText("Length")
self.CB_Length.setToolTip("<img src=" + self.path + "Macro_FCTreeView_19.png" + " />" + "\n"
"If Checked sort by string length")

self.groupBox_Global.setTitle("Global")
# self.PB_Reverse.setText("Reverse")
# self.PB_Reverse.setToolTip("<img src=" + self.path + "Macro_FCTreeView_08.png" + " />" + "\n"
# "Reverse the data listing")
self.PB_SplitName.setText("Split")
self.PB_SplitName.setToolTip("<img src=" + self.path + "Macro_FCTreeView_21.png" + " />" + "\n"
"Split name and label")
self.PB_Expend.setText("Expend")
self.PB_Expend.setToolTip("<img src=" + self.path + "Macro_FCTreeView_15.png" + " />" + "\n"
"Expend the listing objects")
self.PB_Visibility.setText("Visibility")
self.PB_Visibility.setToolTip("<img src=" + self.path + "Macro_FCTreeView_06.png" + " />" + "\n"
"The first icon display the visibility or not")
self.PB_Group.setText("Group")
self.PB_Group.setToolTip("<img src=" + self.path + "Macro_FCTreeView_07.png" + " />" + "\n"
"The first icon display the group or not")
self.PB_Reload.setText("Reload")
self.PB_Reload.setToolTip("<img src=" + self.path + "Macro_FCTreeView_16.png" + " />" + "\n"
"Reload the <b>ACTUAL VIEW</b> on 3D Screen")
self.PB_Original.setText("Original")
self.PB_Original.setToolTip("<img src=" + self.path + "Macro_FCTreeView_18.png" + " />" + "\n"
"Return to original objects organisation and visibility")
self.PB_All_Visible.setText("All Visible")
self.PB_All_Visible.setToolTip("<img src=" + self.path + "Macro_FCTreeView_01.png" + " />" + "\n"
"All objects Visible" + "\n"
"For restitute the original organisation click to <b>Original</b> button" + "\n"
" <img src=" + self.path + "Macro_FCTreeView_18.png" + " />")
self.PB_All_Hidden.setText("All Hidden")
self.PB_All_Hidden.setToolTip("<img src=" + self.path + "Macro_FCTreeView_02.png" + " />" + "\n"
"All objects Hidden" + "\n"
"For restitute the original organisation click to <b>Original</b> button" + "\n"
"<img src=" + self.path + "Macro_FCTreeView_18.png" + " />")
self.groupBox_Search.setTitle("Search")
self.PB_ClearLEdit.setText("Clear")
self.PB_ClearLEdit.setToolTip("Clear the Line Search same lineEdit emptied <img src=" + self.path + "Macro_FCTreeView_20.png" + " />")

self.RB_01_NameLabel.setText("NLwc")
self.RB_01_NameLabel.setToolTip("Search by Name and Label Without respecting the sensitive Case")
self.RB_02_Name_CS.setText("Nsc")
self.RB_02_Name_CS.setToolTip("Search by Name and respecting the Sensitive Case")
self.RB_03_Label_NC.setText("Lwc")
self.RB_03_Label_NC.setToolTip("Search by Label Without respecting the sensitive Case")
self.RB_04_NamLabel_CS.setText("NLsc")
self.RB_04_NamLabel_CS.setToolTip("Search by Name and Label and respecting the Sensitive Case")
self.RB_05_NameLabel_AL.setText("NLwsc")
self.RB_05_NameLabel_AL.setToolTip("Search by Name and Label in Word and respecting the Sensitive Case" + "\n"
"(same panel selection of FreeCAD)")
# self.PB_Quit.setText("Quit")
# self.PB_Quit.setToolTip("Quit FCTreeView <img src=" + self.path + "Macro_FCTreeView_09.png" + " />")
self.PB_Select.setText("Select")
self.PB_Select.setToolTip("Select all object(s) displayed <img src=" + self.path + "Macro_FCTreeView_23.png" + " />")

def details(self, type, name ):
if type == 0:
Fdoc = FreeCAD.ActiveDocument.getObject(name)
else:
Fdoc = FreeCAD.ActiveDocument.getObjectsByLabel(name)[0]
try:
Bx = ("Base\nX : "+str(round(Fdoc.Placement.Base[0],3))+"\n")
By = ("Y : "+str(round(Fdoc.Placement.Base[1],3))+"\n")
Bz = ("Z : "+str(round(Fdoc.Placement.Base[2],3))+"\n\n")
base = Bx + By + Bz
except Exception:
base = ""
try:
Rx = ("Rotation\nX : "+str(round(Fdoc.Placement.Rotation.toEuler()[0],3))+"\n")
Ry = ("Y : "+str(round(Fdoc.Placement.Rotation.toEuler()[1],3))+"\n")
Rz = ("Z : "+str(round(Fdoc.Placement.Rotation.toEuler()[2],3))+"\n\n")
rotation = Rx + Ry + Rz
except Exception:
rotation = ""
try:
Cx = ("CenterOfMass\nX : "+str(round(Fdoc.Shape.CenterOfMass[0],3))+"\n")
Cy = ("Y : "+str(round(Fdoc.Shape.CenterOfMass[1],3))+"\n")
Cz = ("Z : "+str(round(Fdoc.Shape.CenterOfMass[2],3))+"\n\n")
centerOfMass = Cx + Cy + Cz
except Exception:
centerOfMass = ""
return name[:20] + "\n\n" + base + rotation + centerOfMass

def on_treeWidget_clicked(self, item):
global listeObjetsOriginal
global titre
global ui
global doc
global searchString

ligne = item.row() # index dans la liste
colonne = item.column() # index dans la liste
nomObjetListe = item.data() # donne le nom clique
nomParentBase = item.parent().data()# donne le nom du maitre
# print "ligne ",ligne
# print "colonne ",colonne
# print "nomObjetListe ",nomObjetListe
# print "nomParentBase ",nomParentBase

try:
if (nomObjetListe == "False") or (nomObjetListe == "True"):
if nomObjetListe == "False":
try:
FreeCAD.ActiveDocument.getObject(nomParentBase.encode('utf-8')).ViewObject.Visibility = True
except Exception:
App.ActiveDocument.getObjectsByLabel(nomParentBase.encode('utf-8'))[0].ViewObject.Visibility = True
else:
try:
FreeCAD.ActiveDocument.getObject(nomParentBase.encode('utf-8')).ViewObject.Visibility = False
except Exception:
App.ActiveDocument.getObjectsByLabel(nomParentBase.encode('utf-8'))[0].ViewObject.Visibility = False
if searchString == " Searched":
ui.loadObjects()
ui.on_lineEdit_Search_Pressed()
else:
ui.on_PB_Reload_clicked()
FreeCADGui.Selection.clearSelection()
if nomParentBase == doc:
try:
FreeCADGui.Selection.addSelection(App.ActiveDocument.getObject(nomObjetListe.encode('utf-8')))
self.treeWidget.setToolTip( ui.details(0, nomObjetListe.encode('utf-8')))
except Exception:
FreeCADGui.Selection.addSelection(App.ActiveDocument.getObjectsByLabel(nomObjetListe.encode('utf-8'))[0])
self.treeWidget.setToolTip( ui.details(1, nomObjetListe.encode('utf-8')))
else:
try:
FreeCADGui.Selection.addSelection(App.ActiveDocument.getObject(nomParentBase.encode('utf-8')))
self.treeWidget.setToolTip( ui.details(0, nomParentBase.encode('utf-8')))
except Exception:
FreeCADGui.Selection.addSelection(App.ActiveDocument.getObjectsByLabel(nomParentBase.encode('utf-8'))[0])
self.treeWidget.setToolTip( ui.details(1, nomParentBase.encode('utf-8')))
#zoom_selection # https://forum.freecadweb.org/viewtopic.php?f=8&t=15132
Gui.SendMsgToActiveView("ViewSelection")
Gui.runCommand("Std_TreeSelection")
except Exception:
self.treeWidget.setToolTip("The title display the option, number and type object(s) displayed" + "\n" + "\n"
"O = Original" + "\n"
"N = Name" + "\n"
"L = Label" + "\n"
"T = Total" + "\n"
"G = Group" + "\n"
"S = Single" + "\n"
"V = Visible" + "\n"
"H = Hidden" + "\n\n"
"If one object are selected :" + "\n"
"the Placement Base, Rotation and Center of mass is displayed" + "\n"
"if available !")
FreeCAD.Console.PrintError("Error clicked" + "\n")

def sorted_List(self, option): # listing after sorted
global doc
global listeSorted
global titre
global derouler
global visibilite
global group
global SplitNameLabel

enteteTitres = QtGui.QTreeWidgetItem([" Sorted" + option,]) # titres entete des colonnes
self.treeWidget.setHeaderItem(enteteTitres) # affichage des titres #Another alternative is setHeaderLabels(["Tree","First",...])
documentActif = QtGui.QTreeWidgetItem(self.treeWidget, [str(doc)]) # titre du document
documentActif.setExpanded(True) # expent tous les enfants

# #[objName, objLabel, "False", objGroupe, objLName, objLLabel, objLGroupe, objSignal]
for obj in listeSorted:

A = QtGui.QTreeWidgetItem(documentActif, [obj[0]]) # premier objet dans l'arbre du document
if obj[3] == "-":
A.setIcon(0,self.iconName) # premiere rangee titre
else:
A.setIcon(0,self.iconFolder) # premiere rangee titre

if derouler == 1:
A.setExpanded(True) # expent tous les enfants

etat = QtGui.QTreeWidgetItem(A)
if obj[-1] == 1: # convert firt char lower original
objL = obj[1][0].lower() + obj[1][1:]
etat.setText(0,objL) # label
else:
etat.setText(0,obj[1]) # label
etat.setIcon(0,self.iconLabel)

etat2 = QtGui.QTreeWidgetItem(A)
if obj[2] == "True":
etat2.setText(0,"True") # premiere rangee
etat2.setIcon(0,self.iconTrue) # premiere rangee
if visibilite == 1:
A.setIcon(0,self.iconTrue) # premiere rangee titre
else:
etat2.setText(0,"False") # premiere rangee
etat2.setIcon(0,self.iconFalse) # premiere rangee
if visibilite == 1:
A.setIcon(0,self.iconFalse) # premiere rangee titre

etat3 = QtGui.QTreeWidgetItem(A)
if obj[3] == "-":
if group == 1:
A.setIcon(0,self.iconChainCut) # premiere rangee titre
None
else:
etat3.setText(0,obj[3])
etat3.setIcon(0,self.iconChain) # premiere rangee
if group == 1:
A.setIcon(0,self.iconChain) # premiere rangee titre

if SplitNameLabel == 1:
A = QtGui.QTreeWidgetItem(documentActif, [obj[1]]) # premier objet dans l'arbre du document
if obj[-1] == 1: # convert firt char lower original
objL = obj[1][0].lower() + obj[1][1:]
A.setText(0,objL) # label
else:
A.setText(0,obj[1]) # label
A.setIcon(0,self.iconLabel) # premiere rangee titre

if derouler == 1:
A.setExpanded(True) # expent tous les enfants

B = QtGui.QTreeWidgetItem(A)
if obj[3] == "-":
B.setIcon(0,self.iconName) # premiere rangee titre
else:
B.setIcon(0,self.iconFolder) # premiere rangee titre
B.setText(0,obj[0]) # name

C = QtGui.QTreeWidgetItem(A)
if obj[2] == "True":
C.setText(0,"True") # premiere rangee
C.setIcon(0,self.iconTrue) # premiere rangee
if visibilite == 1:
A.setIcon(0,self.iconTrue) # premiere rangee titre
else:
C.setText(0,"False") # premiere rangee
C.setIcon(0,self.iconFalse) # premiere rangee
if visibilite == 1:
A.setIcon(0,self.iconFalse) # premiere rangee titre
D = QtGui.QTreeWidgetItem(A)
if obj[3] == "-":
if group == 1:
A.setIcon(0,self.iconChainCut) # premiere rangee titre
None
else:
D.setText(0,obj[3])
D.setIcon(0,self.iconChain) # premiere rangee
if group == 1:
A.setIcon(0,self.iconChain) # premiere rangee titre

def on_PB_Sort_00_clicked(self): # tableau 0 Nom
global listeSorted
global listeSorted
global ui
global ui
global titre
global reverse_00
global reverse_01
global reverse_02
global reverse_03


None
# #[objName, objLabel, "False", objGroupe, objLName, objLLabel, objLGroupe, objSignal]
}}
if self.CB_Length.isChecked():
<translate>
listeSorted = sorted(listeSorted, key=itemgetter(4))
titre = " by Length Name"
else:
listeSorted = sorted(listeSorted, key=itemgetter(0))
titre = " by Name"
self.treeWidget.clear()
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")


<!--T:74-->
if reverse_00 == 1:
ver 00.08 (2020-02-25) : upgrade with Layout
ui.on_PB_Reverse_clicked()
reverse_00 = 0
else:
reverse_00 = 1
reverse_01 = reverse_02 = reverse_03 = 0
self.treeWidget.verticalScrollBar().setStyleSheet("background-color: #0000ce;")


<!--T:75-->
def on_PB_Sort_01_clicked(self): # tableau 1 Label
ver 00.07 (06/05/2018) : modify procedure for search the last cell used
global listeSorted
global ui
global titre
global reverse_00
global reverse_01
global reverse_02
global reverse_03


<!--T:68-->
# #[objName, objLabel, "False", objGroupe, objLName, objLLabel, objLGroupe, objSignal]
ver 00.06 (13/12/2017) : correct little bug line del line num 1881 "del listeSortedBis[doublon][4:] # supprime le fond inutile" thanks renatorivo
if self.CB_Length.isChecked():
listeSorted = sorted(listeSorted, key=itemgetter(5))
titre = " by Length Label"
else:
listeSorted = sorted(listeSorted, key=itemgetter(1))
titre = " by Label"
self.treeWidget.clear()
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")


<!--T:72-->
if reverse_01 == 1:
ver 00.05 (27/11/2017) : add creation spreadsheet and many option for him
ui.on_PB_Reverse_clicked()
reverse_01 = 0
else:
reverse_01 = 1
reverse_00 = reverse_02 = reverse_03 = 0
self.treeWidget.verticalScrollBar().setStyleSheet("background-color: #0073cc;")


<!--T:52-->
def on_PB_Sort_02_clicked(self): # tableau 2 False True
ver 00.04 (29-09-2017) : add search by numeric value (length, radius....)
global listeSorted
global ui
global titre
global reverse_00
global reverse_01
global reverse_02
global reverse_03


<!--T:54-->
self.treeWidget.clear()
values researched :
listeSorted = sorted(listeSorted, key=itemgetter(2))
</translate>
titre = " by Visibility"
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

if reverse_02 == 1:
ui.on_PB_Reverse_clicked()
reverse_02 = 0
self.treeWidget.verticalScrollBar().setStyleSheet("background-color: #007000;")
else:
reverse_02 = 1
self.treeWidget.verticalScrollBar().setStyleSheet("background-color: #cc0000;")
reverse_00 = reverse_01 = reverse_03 = 0

def on_PB_Sort_03_clicked(self): # tableau 3 False Groupe premier niveau
global listeSorted
global ui
global titre
global reverse_00
global reverse_01
global reverse_02
global reverse_03

if self.CB_Length.isChecked():
listeSorted = sorted(listeSorted, key=itemgetter(6))
titre = " by Length Group"
else:
listeSorted = sorted(listeSorted, key=itemgetter(3))
titre = " by Group"
self.treeWidget.clear()
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

if reverse_03 == 1:
ui.on_PB_Reverse_clicked()
reverse_03 = 0
else:
reverse_03 = 1
reverse_00 = reverse_01 = reverse_02 = 0
self.treeWidget.verticalScrollBar().setStyleSheet("background-color: #ff5555;")

def on_PB_Reverse_clicked(self): # reverse tableau
global listeSorted
global ui
global titre
listeSorted.reverse()
self.treeWidget.clear()
if titre[-9:] == " reverse>":
titre = titre.replace(">","<")
elif titre[-9:] == " reverse<":
titre = titre.replace("<",">")
else:
titre += " reverse<"
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

def on_PB_SplitName_clicked(self): # Split Name and Label
global ui
global titre
global SplitNameLabel
global listeSorted

if SplitNameLabel == 0:
self.PB_SplitName.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_21.png"))
self.PB_SplitName.setToolTip("Split name and label <img src=" + self.path + "Macro_FCTreeView_22.png" + " />")
SplitNameLabel = 1
else:
self.PB_SplitName.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_22.png"))
self.PB_SplitName.setToolTip("Split name and label <img src=" + self.path + "Macro_FCTreeView_21.png" + " />")
SplitNameLabel = 0
self.treeWidget.clear()
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")
def on_PB_Expend_clicked(self):
global ui
global titre
global derouler
global listeSorted

if derouler == 1:
derouler = 0
self.PB_Expend.setText("Develop")
self.PB_Expend.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_15.png"))
self.PB_Expend.setToolTip("Click for Develop the listing objects <img src=" + self.path + "Macro_FCTreeView_15.png" + " />")
else:
derouler = 1
self.PB_Expend.setText("Fold")
self.PB_Expend.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_14.png"))
self.PB_Expend.setToolTip("Click for Fold the listing objects <img src=" + self.path + "Macro_FCTreeView_14.png" + " />")

self.treeWidget.clear()
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

def loadObjects(self):
global doc
global listeObjetsOriginal
global listeSorted
global ui
global titre

enteteTitres = QtGui.QTreeWidgetItem(["Etiquette",]) # titres entete 1 colonnes
self.treeWidget.setHeaderItem(enteteTitres) # affichage des titres #(["Tree","First",...])
documentActif = QtGui.QTreeWidgetItem(self.treeWidget, [str(doc.encode('utf-8'))+" Original"]) # titre du document

del listeObjetsOriginal[:]
del listeSorted[:]

#### Liste ######
for obj in FreeCAD.ActiveDocument.Objects:
objName = obj.Name
objLabel = obj.Label
objGroupe = ""
objLName = 0
objLLabel = 0
objLGroupe = 0
objSignal = 0

if objLabel[0].islower(): # firt char lower
objLabel = objLabel[0].upper() + objLabel[1:]
objSignal = 1

####recherche de groupe et enfants debut####
if len(obj.OutList) != 0:
if len(obj.OutList) > 1:
objGroupe = obj.Label + " (" + str(len(obj.OutList)) + " Objects)"
else:
objGroupe = obj.Label + " (" + str(len(obj.OutList)) + " Object)"
for enfants in obj.OutList:
objGroupe += "\n" + " ( " + enfants.Label + " )"
else:
objGroupe = "-"
####recherche de groupe et enfants fin####

objLName = len(objName) # length
objLLabel = len(objLabel) # length
objLGroupe = len(objGroupe) # length

####
# if Gui.activeDocument().getObject(objName).Visibility == True:
# listeObjetsOriginal.append([objName, objLabel, "True", objGroupe, objLName, objLLabel, objLGroupe, objSignal])
# else:
# listeObjetsOriginal.append([objName, objLabel, "False", objGroupe, objLName, objLLabel, objLGroupe, objSignal])
listeObjetsOriginal.append([objName, objLabel, str(Gui.activeDocument().getObject(objName).Visibility), objGroupe, objLName, objLLabel, objLGroupe, objSignal])
####
####
self.treeWidget.clear() # efface le contenu du widget
listeSorted = copy.deepcopy(listeObjetsOriginal) # original organisation on begin
titre = " Original" # original organisation on begin
#
# listeSorted = sorted(listeSorted, key=itemgetter(0)) # sorted by Name on begin
# titre = " by Name" # sorted by Name on begin
####
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

def on_PB_Visibility_clicked(self):
global visibilite
global group
global ui
global listeSorted

group = 0
if visibilite == 0:
visibilite = 1
else:
visibilite = 0

visible = cache = 0
for i in listeSorted:
if i[2] == "True":
visible += 1
else:
cache += 1
self.treeWidget.clear() # efface le widget
ui.sorted_List(titre + " (V " + str(visible) + ") (H " + str(cache) + ") = (O " + str(visible + cache) + ")")

def on_PB_Group_clicked(self):
global group
global visibilite
global ui
global listeSorted

visibilite = 0
if group == 0:
group = 1
else:
group = 0

groupe = simple = 0
for i in listeSorted:
if i[3] == "-":
groupe += 1
else:
simple += 1

self.treeWidget.clear() # efface le widget
ui.sorted_List(titre + " (G " + str(groupe) + ") (S " + str(simple) + ") = (O " + str(groupe + simple) + ")")

def on_PB_Original_clicked(self): # tableau organisation
global listeObjetsOriginal
global listeSorted
global ui
global titre

for obj in listeObjetsOriginal:
if obj[2] == "True":
Gui.activeDocument().getObject(obj[0]).Visibility = True
else:
Gui.activeDocument().getObject(obj[0]).Visibility = False

listeSorted = copy.deepcopy(listeObjetsOriginal)
self.treeWidget.clear()
titre = " Original"
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")
self.treeWidget.verticalScrollBar().setStyleSheet("background-color: QPalette.Base;")

def on_PB_All_Visible_clicked(self):
global listeSorted
global ui
global titre

i = 0
for obj in listeSorted:
Gui.activeDocument().getObject(obj[0]).Visibility = True
listeSorted[i][2] = "True"
i += 1
self.treeWidget.clear() # efface le widget
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

def on_PB_All_Hidden_clicked(self):
global listeSorted
global ui
global titre

i = 0
for obj in listeSorted:
Gui.activeDocument().getObject(obj[0]).Visibility = False
listeSorted[i][2] = "False"
i += 1
self.treeWidget.clear() # efface le widget
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

def on_PB_Reload_clicked(self):
global ui
global titre

self.treeWidget.clear()
titre = " Original"
ui.loadObjects()

def on_RB_Pressed(self):
global ui
global titre

self.treeWidget.clear()
ui.on_lineEdit_Search_Pressed()

def on_lineEdit_Search_Pressed(self):
global ui
global titre
global listeSorted
global searchString
global listeObjetsOriginal
global listeByStringSear

self.treeWidget.clear()
titre = " by string"
texte = self.lineEdit_Search.text()
searchString = " Searched"
listeSorted = copy.deepcopy(listeObjetsOriginal)

del listeByStringSear[:]

if texte != "":
comptName = comptLabel = 0

# Search by Name + Label (not casse)
if self.RB_01_NameLabel.isChecked():
texte = texte.upper()
for i in range(len(listeSorted)):
if texte in listeSorted[i][0][:len(texte)].upper(): # Name upper
listeByStringSear.append(listeSorted[i])
comptName += 1
if texte in listeSorted[i][1][:len(texte)].upper(): # Label upper
listeByStringSear.append(listeSorted[i])
comptLabel += 1

# Search by Name (casse)
elif self.RB_02_Name_CS.isChecked(): # case sensitivity
for i in range(len(listeSorted)):
if texte in listeSorted[i][0][:len(texte)]: # Name
listeByStringSear.append(listeSorted[i])
comptName += 1

# Search by Label (not casse)
elif self.RB_03_Label_NC.isChecked():
for i in range(len(listeSorted)):
if texte.upper() in listeSorted[i][1][:len(texte)].upper():# Label
listeByStringSear.append(listeSorted[i])
comptLabel += 1

# Search by Name + Label casse sensitivity
elif self.RB_04_NamLabel_CS.isChecked():
for i in range(len(listeSorted)):
if texte in listeSorted[i][0][:len(texte)]: # Name sensitivity
listeByStringSear.append(listeSorted[i])
comptName += 1
if listeSorted[i][7] == 1:
casse = listeSorted[i][1]
casse = casse[0].lower() + casse[1:]
if texte in casse[:len(texte)]: # Label sensitivity
listeByStringSear.append(listeSorted[i])
comptLabel += 1
elif texte in listeSorted[i][1][:len(texte)]: # Label sensitivity
listeByStringSear.append(listeSorted[i])
comptLabel += 1
# Search by case sensitivity in word
elif self.RB_05_NameLabel_AL.isChecked():
for i in range(len(listeSorted)):
if texte in listeSorted[i][0]: # Name sensitivity in word
listeByStringSear.append(listeSorted[i])
comptName += 1
if listeSorted[i][7] == 1:
casse = listeSorted[i][1]
casse = casse[0].lower() + casse[1:]
if texte in casse: # Label sensitivity in word
listeByStringSear.append(listeSorted[i])
comptLabel += 1
elif texte in listeSorted[i][1]: # Label sensitivity in word
listeByStringSear.append(listeSorted[i])
comptLabel += 1

titre = " by string"
listeSorted = copy.deepcopy(listeByStringSear)

ui.sorted_List(titre +" (N " + str(comptName) + ") (L " + str(comptLabel) + ") = (T " + str(comptName + comptLabel) + ")")
else:
listeSorted = copy.deepcopy(listeObjetsOriginal)
ui.on_PB_ClearLEdit_clicked()

def on_PB_ClearLEdit_clicked(self):
global ui
global titre
global searchString

searchString = ""
self.treeWidget.clear()
self.lineEdit_Search.clear()
self.RB_01_NameLabel.setChecked(True)#
titre = " Original"
ui.sorted_List(titre + " (O " + str(len(listeSorted)) + ")")

def on_PB_Select_clicked(self):
global listeSorted
global ui
global titre
global selections

self.treeWidget.setToolTip("The title display the option, number and type object(s) displayed" + "\n" + "\n"
"O = Original" + "\n"
"N = Name" + "\n"
"L = Label" + "\n"
"T = Total" + "\n"
"G = Group" + "\n"
"S = Single" + "\n"
"V = Visible" + "\n"
"H = Hidden" + "\n\n"
"If one object are selected :" + "\n"
"the Placement Base, Rotation and Center of mass is displayed" + "\n"
"if available !")
if selections == 0:
self.PB_Select.setText("Deselect")
self.PB_Select.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_24.png"))
self.PB_Select.setToolTip("Deselect all object(s) selected <img src=" + self.path + "Macro_FCTreeView_24.png" + " />")
self.treeWidget.setSelectionMode(QtGui.QAbstractItemView.ContiguousSelection)
self.treeWidget.selectAll()
for obj in listeSorted:
FreeCADGui.Selection.addSelection(App.ActiveDocument.getObject(obj[0].encode('utf-8')))
#FreeCADGui.Selection.addSelection(App.ActiveDocument.getObject(unicode(obj[0])))
selections = 1
else:
self.PB_Select.setText("Select")
self.PB_Select.setIcon(QtGui.QIcon(self.path + "Macro_FCTreeView_23.png"))
self.PB_Select.setToolTip("Select all object(s) displayed <img src=" + self.path + "Macro_FCTreeView_23.png" + " />")
self.treeWidget.clearSelection()
FreeCADGui.Selection.clearSelection()
selections = 0


# def on_PB_Quit_clicked(self):
#
## self.vueActive.removeEventCallback("SoMouseButtonEvent",self.click) # desinstalle la fonction souris
## FreeCADGui.Selection.removeObserver(s) # desinstalle la fonction residente SelObserver
# self.window.hide() # hide the window and close the macro
# FreeCAD.Console.PrintMessage("Quit FCTreeView" + "\n")

##################################################################################################
#class SelObserver:
# def addSelection(self, document, object, element, position): # Selection
# global sourisPass
# if sourisPass == 0:
# sourisPass = 1
# else:
# sourisPass = 0
#
# print object
# ff = ui
# ff.souris()

## def setPreselection(self,doc,obj,sub): # preselection
## print "setPreselection"
## def removeSelection(self,doc,obj,sub): # Effacer l'objet selectionne
## print "removeSelection"
## def setSelection(self,doc): # Selection dans ComboView
## print "SelObserver quit macro"
## def clearSelection(self,doc): # Si clic sur l'ecran, effacer la selection
## print "clearSelection" # Si clic sur un autre objet, efface le precedent

#s=SelObserver()
#FreeCADGui.Selection.addObserver(s) # installe la fonction en mode resident
###################################################################################################

doc = App.activeDocument()
if doc == None:
doc = FreeCAD.newDocument()
doc = unicode(doc.Name)

MainWindow = QtGui.QMainWindow()
ui = Ui_MainWindow(MainWindow)
ui.setupUi(MainWindow)
MainWindow.show()
ui.loadObjects()


{{Code|code=
global impost ; impost = ["Angle","Angle0","Angle1","Angle2","Angle3","ChamferSize","Circumradius","Columns","Degree",
"FilletRadius","FirstAngle","Growth","Height","LastAngle","Length","Length2","MajorRadius",
"MinorRadius","Pitch","Polygon","Radius","Radius1","Radius2","Radius3","Rows","Size","Width",
"X","X1","X2","Xmax","Xmin","X2max","X2min",
"Y","Y1","Y2","Ymax","Ymin","Y2max","Y2min",
"Z","Z1","Z2","Zmax","Zmin","Z2max","Z2min"]
}}
}}
<translate>


<!--T:55-->
==To do==
ver 00.03 (23/09/2017) : add search by type object

Docked


<!--T:48-->
==Version==
ver 00.02 (11/09/2017) : modify for docked and prevent many instance the clic on button are effect flip/flop (macro hide/visible)


<!--T:51-->
ver 00.01 (08/09/2017) :
ver 00.01 (08/09/2017) :
</translate>

Revision as of 18:03, 24 September 2020

Other languages:

Macro FCTreeView

Description
New version GUI modifyed for the HD dpi (QGridLayout) run only FC version 0.18 and more (PySide2 Qt5)

Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label .... without case sensitive or with case sensitive and select all objects displayed in the macro window.

For the precedent version see Macro_FCTreeView.FCMacro and install it manually.

Macro version: 00.09
Last modified: 2020-09-24
FreeCAD version: 0.18 and below
Download: Macro FCTreeView Icon package unzip the .zip file and copy the icon in your macro directory.
Author: Mario52
Author
Mario52
Download
Macro FCTreeView Icon package unzip the .zip file and copy the icon in your macro directory.
Links
Macro Version
00.09
Date last modified
2020-09-24
FreeCAD Version(s)
0.18 and below
Default shortcut
None
See also
None

Description

Macro for list all objects in the project in one list without hierarchy, options sort by name, label, visibility, group, by length option search by name, label .... without case sensitive or with case sensitive and select all objects displayed in the macro window.

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon Manager. Link for optional manual installation: Macro


# This code is copied instead of the original macro code
# to guide the user to the online download page.
# Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki
# or if the RAW code URL is somewhere else in the wiki.

from PySide import QtGui, QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,
    "Information",
    "This macro must be downloaded from this link\n"
    "\n"
    "https://gist.githubusercontent.com/mario52a/67517ef758ff20005d0a6adcfd8c9190/raw/59bc2028978c82744c83c6b138ab3ef30e0bf6f3/Macro_FCTreeView.FCMacro" + "\n"
    "\n"
    "Quit this window to access the download page")

diag.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
diag.setWindowModality(QtCore.Qt.ApplicationModal)
diag.exec_()

import webbrowser 
webbrowser.open("https://gist.githubusercontent.com/mario52a/67517ef758ff20005d0a6adcfd8c9190/raw/59bc2028978c82744c83c6b138ab3ef30e0bf6f3/Macro_FCTreeView.FCMacro")

How To Use

Macro FCTreeView


Section Window

The title display the option, number and type object(s) displayed

  • O = Objects
  • N = Name
  • L = Label
  • T = Total
  • G = Group
  • S = Single
  • V = Visible
  • H = Hidden

If one object are selected : the Placement Base, Rotation and Center of mass is displayed (if available !) Icon used for the Name of object Icon used for the Name of object (the scrollbar is colored blue)

Icon used for the Label of object Icon used for the Label of object (the scrollbar is colored blue clear)

Icon used for visualise if the object is status Visible (mouse click for Hidden) Icon used for visualise if the object is status Visible (mouse click for Hidden) (the scrollbar is colored green)

Icon used for visualise if the object is status Hidden (mouse click for Visible) Icon used for visualise if the object is status Hidden (mouse click for Visible) (the scrollbar is colored red)

Icon used for the Name contains objects (or folder Group) Icon used for the Name contains objects (or folder Group)

Icon used for inform the object in a group the number objects is displayed in top group Icon used for inform the object in a group the number objects is displayed in top group (the scrollbar is colored red clear)

Icon used for displayed the single object (not group) Icon used for displayed the single object (not group)

Section Sort by :

Name Icon used for flip/flop normal/reverse the data listing sort by Name

Label Icon used for flip/flop normal/reverse the data listing sort by Label

Visible Icon used for flip/flop normal/reverse the data listing sort by Visibile/Hidden

Group Icon used for flip/flop normal/reverse the data listing sort by Group/Single object

Length If this check Box is checked the sort is created by length with the button clicked (Name, Label ...)

Section Global

Split flip/flop Split the Name list

Split flip/flop Split the Name and Label list

Expend flip/flop the data listing Fold/Expend

Expend flip/flop the data listing Expend/Fold

Visibility flip/flop normal/Visibility

Group flip/flop normal/Group

Reload reload the data in the project

Original return in original organisation after operation visibility/Hidden

All Visible visualise if the object is status Visible

All Hidden visualise if the object is status Hidden

Section Search

Clear Clear the search line edit

The radioButton options Search:

  • ("NLwc") : Search by Name and Label Without respecting the sensitive Case
  • ("Nsc") : Search by Name and respecting the Sensitive Case
  • ("Lwc") : Search by Label Without respecting the sensitive Case
  • ("NLsc") : Search by Name and Label and respecting the Sensitive Case
  • ("NLwsc") : Search by Name and Label in Word and respecting the Sensitive Case (same panel selection of FreeCAD)
  • (Nu)  : Search by numeric value (radius, length, angle .....) see version section

Select flip/flop for Selected all object(s) displayed in the window

Unselected flip/flop Unselected all object(s)

S Sheet access in Spreadsheet options

The SpreadSheet options:

Macro FCTreeView

  • CheckBox options for select the data to save in spreadsheet

Select : Select all checkBox option to save

Select : unSelect all checkBox option to save

  • Value : alone the value is saved in the cell
    • Ex : 10.00
  • Val Gr : the value and the unit are saved in unique cell
    • Ex : 10.00 mm
  • Val Gr Ph : the value, the unit and the physic data is saved in unique cell
    • Ex : 10.00 mm Length
  • Split : if the Split checkBox is checked, the data is cut saved in separate cell
    • Ex : 10.00 | mm | length

  • Combobox mm : select the unit length desired. The value is convert in the selected unit. The units length available are:
    • km, hm, dam, m, dm, cm, mm, um, nm, pm, fm, in, lk, ft, yd, rd, ch, fur, mi, lea, nmi
  • Combobox gram : select the unit weight desired. The value is convert in the selected unit. The units weight available are:
    • t, q, kg, hg, dag, g, dg, cg, mg, µg, ng, pg, fg, gr, dr, oz, oz t, lb, t lb, st, qtr, cwt, tonneau fr, ct
  • Spinbox Densite : give the density by dm3 of the material used (Default : 1.0000)
  • Spinbox Round : give the round value desired (Default : 3)

  • Combobox Name spreadSheet : List the spreadsheet in the document
  • Line edit Name spreadSheet : Display the actual spreadsheet or give the name for the new spreadsheet

Select select all checkbox options

Unselect unselected all checkbox options

Save save the data in Spreadsheet displayed. if no spreadsheet is active the spreadsheet named FCSpreadSheet is created

Quit quit the Spreadsheet options

Icons

The icon must be copied into the same directory as the macro Macro_FCTreeView_Icon

Icon used for the Name of object Icon used for visualise if the object is status Visible (mouse click for Hidden) Icon used for visualise if the object is status Hidden (mouse click for Visible) Icon used for inform the object in a group the number objects is displayed in top group Icon used for displayed the single object (not group) Icon used for the Label of object Icon used for flip/flop normal/Visibility Icon used for flip/flop normal/Group Icon used for Reverse the data listing (momentarily not used) Icon used for quit Macro FCTreeView (momentarily not used) Icon used for flip/flop normal/reverse the data listing sort by Name Icon used for flip/flop normal/reverse the data listing sort by Label Icon used for flip/flop normal/reverse the data listing sort by Visibility/Hidden Icon used for flip/flop normal/reverse the data listing sort by Grout/Single object Icon used for flip/flop the data listing Fold/Expend Icon used for flip/flop the data listing Expend/Fold Icon used for reload the data in the project Icon used for the Name contains objects (or folder Group) Icon used for return in original organisation after operation visibility/Hidden If this check Box is checked the sort is created by length with the button clicked (Name, Label ...) Icon used for Clear the search line edit Icon used for flip/flop Split the Name list Icon used for flip/flop Split the Name and Label list Icon used for Selected all object(s) displayed in the window Icon used for Unselected all object(s) Icon used for access in Spreadsheet options Icon used for quit the Spreadsheet options Icon used for save the data in Spreadsheet Icon used for select all checkbox options Icon used for unselected all checkbox options Icon used for save the value data in Spreadsheet Icon used for save the value and Unit data in Spreadsheet Icon used for save the value, Unit and type data in Spreadsheet Icon used for split the value, Unit and type in cell separate in Spreadsheet

Script

For prevent many instance the clic on ToolBar button are effect flip/flop (hide/visible)

The macro is located in right dock for change it modify the value line number 133 testing = 0 (or change it with the mouse as a widget normal)

The icon ToolBar Macro FCTreeView

Macro_FCTreeView.FCMacro


To do

Docked the macro

Version

ver 00.09 (2020-09-24) : correct the "freeze" macro after call the assembly4 workbench i try activate "Class SelObserver" and it work ???

class SelObserver:
    def addSelection(self, document, object, element, position):  # Selection
        global sourisPass
        global listeSorted
        global ui

        None

ver 00.08 (2020-02-25) : upgrade with Layout

ver 00.07 (06/05/2018) : modify procedure for search the last cell used

ver 00.06 (13/12/2017) : correct little bug line del line num 1881 "del listeSortedBis[doublon][4:] # supprime le fond inutile" thanks renatorivo

ver 00.05 (27/11/2017) : add creation spreadsheet and many option for him

ver 00.04 (29-09-2017) : add search by numeric value (length, radius....)

values researched :

global impost                 ; impost = ["Angle","Angle0","Angle1","Angle2","Angle3","ChamferSize","Circumradius","Columns","Degree",
                                          "FilletRadius","FirstAngle","Growth","Height","LastAngle","Length","Length2","MajorRadius",
                                          "MinorRadius","Pitch","Polygon","Radius","Radius1","Radius2","Radius3","Rows","Size","Width",
                                          "X","X1","X2","Xmax","Xmin","X2max","X2min",
                                          "Y","Y1","Y2","Ymax","Ymin","Y2max","Y2min",
                                          "Z","Z1","Z2","Zmax","Zmin","Z2max","Z2min"]

ver 00.03 (23/09/2017) : add search by type object

ver 00.02 (11/09/2017) : modify for docked and prevent many instance the clic on button are effect flip/flop (macro hide/visible)

ver 00.01 (08/09/2017)  :