![]() instead of ParamRectangle.ParametricRectangle\(myObj\), you should only write ParametricRectangle\(myObj\)The l\ine of codes therefore become 5, as below: import FreeCAD # module FreeCAD is not know in the macro scope, must import itmyOb\j = \("Part::FeaturePython","Rectangle"\)ParametricRectangle\(myObj\) # we simply reference the above defined = 0 # this is mandatory unless we code the ViewProvider\ \(\))/Rect/Subj(Highlight)/Subtype/Highlight/T(ediloren)/Type/Annot>endobj2761 0 objendobj2762 0 objendobj2763 0 obj>/ProcSet/XObject>/Subtype/Form/Type/XObject>streamĮndstreamendobj2764 0 obj/Length 9/Matrix/Resources>/Subtype/Form/Type/XObject>streamĮndstreamendobj2765 0 >endobj2767 0 obj>/ProcSet/XObject>/Subtype/Form/Type/XObject>streamĮndstreamendobj2768 0 obj/Length 9/Matrix/Resources>/Subtype/Form/Type/XObject>streamĮndstreamendobj2769 0 obj/Subtype/Form/Type/XObject>streamġ71.5888 283.0476 171.5888 288.8994 174.1981 291.5087 cĢ86.1362 288.8994 286.1362 283.0476 283.5269 280.4383 c The lines need to be modified: first, FreeCAD must be imported \(it was imported only within the scope of the _init_ function\) second, we should not reference the module itself anymore, but only th\e above class, i.e. instead of Param\Rectangle.ParametricRectangle\(myObj\), you should only write ParametricRectangle\(myObj\)\r\rThe line of codes therefore become 5, as below:\r\rimport FreeCAD # module FreeCAD is not know in the macro scope, must import it\rmyObj = FreeCAD.ActiveDocumen\t.addObject\("Part::FeaturePython","Rectangle"\)\rParametricRectangle\(myObj\) # we simply reference the above defined class\ = 0 # this is mandatory unless we code the ViewProvider too\\(\)\r\r)/CreationDate(D:20160901103439 02'00')/F 4/M(D:20160901103722 02'00')/NM(85210f00-7468-4bac-8117-50742d6ad30a)/P 1003 0 R/Popup 2761 0 R/QuadPoints/RC( The lines need to be modified: \rfirst, FreeCAD must be imported \(it was imported only within the scope of the _init_ function\) second, we should not reference the module itself anymore, but only the above class, i.e. reload\(ParamRectangle\))/Rect/Subj(Highlight)/Subtype/Highlight/T(ediloren)/Type/Annot>endobj2759 0 objendobj2760 0 obj/BS 2762 0 R/C/Contents(Not fully true. You need to use the reload\(\) functi\on, i.e. If ParamRectangle had already been imported, Python will not import it again, even if the source file has been changed, so you'd see no effect. You need to use the reload\(\) function, i.e. a toolbar visible in any workbench\)")/Rect/Subj(Highlight)/Subtype/Highlight/T(ediloren)/Type/Annot>endobj2753 0 objendobj2754 0 objendobj2755 0 obj>/ProcSet/XObject>/Subtype/Form/Type/XObject>streamĮndstreamendobj2756 0 obj/Length 9/Matrix/Resources>/Subtype/Form/Type/XObject>streamĮndstreamendobj20 R/C/Contents(I think this is wrong and does not work. you switch to another workbench and back \(if inserted under a spedific workbench\) or just switch \(if inserted under "Global", i\.e. "Remark: the new toolbar is NOT visible until you refresh the toolbars, i.e.
0 Comments
Leave a Reply. |