Help us understand the problem. What is going on with this article?

FreeCADのpythonマクロでTree viewをReport viewに表示 してみた

More than 1 year has passed since last update.
# -*- coding: utf-8 -*-
def MYSelect_all():
# https://forum.freecadweb.org/viewtopic.php?f=3&t=19248
# Code: Select all
    Gui.Selection.clearSelection()
    for obj in FreeCAD.ActiveDocument.Objects:
        if obj.ViewObject.isVisible():
           Gui.Selection.addSelection(obj)
    return
# ------------------------------------------------------
def MYclear_report():
# https://forum.freecadweb.org/viewtopic.php?t=9825
# clear console and clear report by python
    from PySide import QtGui
    mw=Gui.getMainWindow()
    r=mw.findChild(QtGui.QTextEdit, "Report view")
    r.clear()
    return
# ------------------------------------------------------
import time
print "開始:",time.ctime()
MYclear_report()
MYSelect_all()
# https://www.freecadweb.org/wiki/Manual/jp
# 選択機能を使う
for o in Gui.Selection.getSelectionEx():
    print "オブジェクト = ",o.ObjectName ,"(",o.Object.Label,")"
    for s in o.SubElementNames:
        print "name: ",s
    for s in o.SubObjects:
        print "object: ",s

Gui.Selection.clearSelection() 
print "終了"

# o.Labelとすると、以下のエラーがでます。
# <type 'exceptions.AttributeError'>: 'Gui.SelectionObject' object has no attribute 'Label'

(参考)マクロでラベルを出力する方法を教えて下さい
https://forum.freecadweb.org/viewtopic.php?f=16&t=26805

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした