FreeCAD-Doc/localwiki/ViewObject_API.html
2018-07-08 12:11:49 -05:00

252 lines
11 KiB
HTML

<html><head><title>ViewObject API</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>ViewObject API</h1></div>
<div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><div class="mw-parser-output"><p>When the GUI is up, each object in the FreeCAD document has an associated ViewObject, that resides in the FreeCADGui document counterpart. A view object can be retrieved by two ways. Example:
</p>
<pre>myViewObj = FreeCAD.ActiveDocument.myObjectName.ViewObject
myViewObj = FreeCADGui.ActiveDocument.myObjectName
print myViewObj.IV </pre>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>Annotation</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> the annotation node of a ViewObject
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>BoundingBox</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> the bounding box
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>Content</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> an XML representation of a ViewObject's properties
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>DisplayMode</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> the current display mode
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>IV</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> an Inventor representation of the ViewObject
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>Object</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> the associated FreeCAD Document Object of this ViewObject
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>PropertiesList</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> a list of properties of this ViewObject
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>RootNode</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> the Inventor node of this ViewObject (pivy.coin object)
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>Selectable</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> True if the object is selectable
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>Type</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> the type of this ViewObject
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Property.png" class="image"><img alt="Property.png" src="Property.png" width="16" height="16" /></a> <big><b>Visibility</b></big></div>
<div class="description">
<p><small><b>Returns</b>:</small> True if the viewObject is visible
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>getAllDerivedFrom</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small>
</p><p><small><b>Returns</b>:</small> all descentences of this object
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>getDocumentationOfProperty</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small>
</p><p><small><b>Returns</b>:</small> the documentation string of the property of this class.
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>getGroupOfProperty</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small>
</p><p><small><b>Returns</b>:</small> the name of the group which the property belongs to in this class. The properties sorted in differnt named groups for convenience.
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>getPropertyByName</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small>
</p><p><small><b>Returns</b>:</small> the value of a named property.
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>getTypeOfProperty</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small>
</p><p><small><b>Returns</b>:</small> the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination.
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>hide</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small> Hides the object.
</p><p><small><b>Returns</b>:</small>
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>isDerivedFrom</b></big> ( <i>string</i> )</div>
<div class="description">
<p><small><b>Description</b>:</small> Checks if this object is derived from the given object type
</p><p><small><b>Returns</b>:</small> True if given type is a father
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>isVisible</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small> Checks if the object is visible
</p><p><small><b>Returns</b>:</small> a boolean
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>listDisplayModes</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small> Shows a list of all display modes
</p><p><small><b>Returns</b>:</small> a list
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>setTransformation</b></big> ( <i>coin.SoTransform</i> )</div>
<div class="description">
<p><small><b>Description</b>:</small> Sets a transformation on the Inventor node
</p><p><small><b>Returns</b>:</small> nothing
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>show</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small> Shows the object if hidden
</p><p><small><b>Returns</b>:</small> nothing
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>toString</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small>
</p><p><small><b>Returns</b>:</small> a string representation of the Inventor node
</p>
</div>
</div>
<p><br />
</p>
<div class="api">
<div class="function"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Method.png" class="image"><img alt="Method.png" src="Method.png" width="16" height="16" /></a> <big><b>update</b></big> ( <i> </i> )</div>
<div class="description">
<p><small><b>Description</b>:</small> Updates the view representation of the object
</p><p><small><b>Returns</b>:</small>
</p>
</div>
</div>
<div style="clear:both"></div>
</div>
</div>
</div><div class="printfooter">
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=ViewObject_API&amp;oldid=133211">http://www.freecadweb.org/wiki/index.php?title=ViewObject_API&amp;oldid=133211</a>"</div>
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
</div>
</div>
<div id="mw-navigation">
<h2>Navigation menu</h2>
</body></html>