Macro Dump Objects: Difference between revisions

From FreeCAD Documentation
No edit summary
No edit summary
Line 1: Line 1:
{{Macro|Icon=Macro_Dump_Objects|Name=Macro_Dump_Objects|Description=This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.|Author=PiffPoof}}
{{Macro|Icon=Macro_Dump_Objects|Name=Macro_Dump_Objects|Description=This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.|Author=PiffPoof}}


<!--T:18-->
<!--T:1-->
[[File:DumpObjectsScreenSnapshot.jpg|500px]]
[[File:DumpObjectsScreenSnapshot.jpg|500px]]


Line 16: Line 16:


==Usage== <!--T:5-->
==Usage== <!--T:5-->
Select the document you wish to dump objects for, then start the macro from either:
Select the document you wish to dump objects for, then start the macro from one of:
- the Macro menu
* the Macro menu
- from the Python console
* from the Python console
- from a Toolbar
* from a Toolbar


Depending on the parameters selected in the first window, the report will be displayed on the Report view or in a window.
Depending on the parameters selected in the first window, the report will be displayed on the Report view or in a window.
The information will show all objects in the current document. Some of the benefits to be expected are the detection of:
The information will show all objects in the current document. Some of the benefits to be expected are the detection of:


- irregularities in object names (e.g. spelling errors or default names generated by FreeCAD)
* irregularities in object names (e.g. spelling errors or default names generated by FreeCAD)
- duplicate objects
* duplicate objects
- objects with duplicate names (where FreeCAD has had to make the second object name unique)
* objects with duplicate names (where FreeCAD has had to make the second object name unique)
- unexpected objects
* unexpected objects
- unexpected object Placements (when the Show Positions option is selected)
* unexpected object Placements (when the Show Positions option is selected)
- unexpected segments in the Sketch Geometry (when the Show Sketcher Segments option is selected)
* unexpected segments in the Sketch Geometry (when the Show Sketcher Segments option is selected)


==User Interface== <!--T:6-->
==User Interface== <!--T:6-->
Line 36: Line 36:
The second window will be the report on the objects in the current document:
The second window will be the report on the objects in the current document:
[[File:DumpObjectsScreenSnapshot.jpg|500px]]
[[File:DumpObjectsScreenSnapshot.jpg|500px]]

==Options== <!--T:7-->

* output may be directed to one of:
** the Report view
**a non-modal window
* segments in the Geometry for each Sketch may be listed
* Placement specifics may be listed for objects

==Remarks== <!--T:8-->

Although tested with many object types in FreeCAD, there probably are some objects that it does not expect, in that case it should list them generically.

==Links== <!--T:9-->
none (so far)

==Script== <!--T:10-->

<---python code--->

Revision as of 20:50, 16 January 2015

File:Macro Dump Objects Macro_Dump_Objects

Description
This macro generates a listing of all objects in the current document - the list can be in a window or on the Report view.

Author: PiffPoof
Author
PiffPoof
Download
None
Links
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Background

When developing complex object models it is easy to loose track of exactly which objects are present as some may be hidden, obscured or transparent. Additionally with a large number of objects a naming system becomes necessary to keep track of the objects.

Description

The Dump Object code takes the current document and enumerates all the objects. A report is then generated listing each object, then a summary giving the total number of instances of each Class, followed by the total number of Classes and finally the total number of objects. The output may be directed to the Report view or to a window. The window is non-modal and will stay open until closed by the user. Each window has the time of the object dump in it's title bar, so the contents of multiple windows can be compared, say before and after a piece of code running.

The default operation lists all objects, optionally the placement of each object can be listed. Also for Sketches, each segment of the Geometry can be listed.

Installation

All the code for dumpObject.FCMacro is in one macro. So installation is comprised of copying the code to the appropriate Macro directory and invoking dumpObject from the Macro menu. Alternatively it may be run from the console.

Usage

Select the document you wish to dump objects for, then start the macro from one of:

  • the Macro menu
  • from the Python console
  • from a Toolbar

Depending on the parameters selected in the first window, the report will be displayed on the Report view or in a window. The information will show all objects in the current document. Some of the benefits to be expected are the detection of:

  • irregularities in object names (e.g. spelling errors or default names generated by FreeCAD)
  • duplicate objects
  • objects with duplicate names (where FreeCAD has had to make the second object name unique)
  • unexpected objects
  • unexpected object Placements (when the Show Positions option is selected)
  • unexpected segments in the Sketch Geometry (when the Show Sketcher Segments option is selected)

User Interface

The first window will take input which configures the Object Dump: The second window will be the report on the objects in the current document:

Options

  • output may be directed to one of:
    • the Report view
    • a non-modal window
  • segments in the Geometry for each Sketch may be listed
  • Placement specifics may be listed for objects

Remarks

Although tested with many object types in FreeCAD, there probably are some objects that it does not expect, in that case it should list them generically.

Links

none (so far)

Script

<---python code--->