Search found 9 matches

by ORE
Tue Oct 23, 2018 7:41 pm
Forum: Python scripting and macros
Topic: How to set Mesh.Export deflection in pure console script
Replies: 0
Views: 520

How to set Mesh.Export deflection in pure console script

I am using the following for exporting shapes as meshes into .stl: mesh_Cyl_2 = App.ActiveDocument.addObject("Mesh::Feature","Mesh_Cyl_2") mesh_Cyl_2.Mesh=MeshPart.meshFromShape(Shape=obj_Cyl_2.Shape.copy(False), LinearDeflection=0.5, AngularDeflection=0.05, Relative=False) mesh_...
by ORE
Tue Oct 23, 2018 3:22 pm
Forum: Python scripting and macros
Topic: How to set the color of a shape
Replies: 9
Views: 5076

Re: How to set the color of a shape

Basically you don't. That's one of the core concepts of FreeCAD that visual properties (color, etc...) are bound to the GUI part of FreeCAD. Thanks for the hint. Anyway in the meantime I found a solution that works perfectly for me. It is based on this post: https://forum.freecadweb.org/viewtopic.p...
by ORE
Tue Oct 23, 2018 11:56 am
Forum: Python scripting and macros
Topic: Object placement ignored by Import.export
Replies: 2
Views: 489

Re: Object placement ignored by Import.export

wmayer wrote: Tue Oct 23, 2018 11:19 am You need one of the latest development snapshots (since October) for 0.18 where this is fixed.
Thank you very much for your fast support! Tried it on 0.18 and works perfectly!
by ORE
Tue Oct 23, 2018 9:40 am
Forum: Python scripting and macros
Topic: Object placement ignored by Import.export
Replies: 2
Views: 489

Object placement ignored by Import.export

In my script I have x-shifted an object using the following : App.ActiveDocument.getObject("Cyl_2").Placement = App.Placement(App.Vector(10,0,0),App.Rotation(App.Vector(0,0,1),0)) This works well on screen, but when I try to export it using Import.export(), this placement is ignored. Impor...
by ORE
Mon Oct 22, 2018 3:20 pm
Forum: Python scripting and macros
Topic: How to set the color of a shape
Replies: 9
Views: 5076

Re: How to set the color of a shape

What do you get if you type "FreeCAD.GuiUp" in the console. I'm guessing you get "0" which means no Gui which is probably why your ViewObject is 'None'. Yes, it is 0 - but I cannot use the GUI since the script shall run automated on a headless server. I am searching for a way to...
by ORE
Mon Oct 22, 2018 1:18 pm
Forum: Python scripting and macros
Topic: How to set the color of a shape
Replies: 9
Views: 5076

Re: How to set the color of a shape

Thanks for your answer. I tried it but get an error: AttributeError: 'NoneType' object has no attribute 'ShapeColor' import FreeCAD import Part App.newDocument("Unbenannt") App.setActiveDocument("Unbenannt") App.ActiveDocument=App.getDocument("Unbenannt") bx = Part.make...
by ORE
Mon Oct 22, 2018 12:13 pm
Forum: Python scripting and macros
Topic: How to set the color of a shape
Replies: 9
Views: 5076

How to set the color of a shape

How can I set the color of a shape without using the GUI (API)? Here is what I want to do: import FreeCAD import Part cube1 = Part.makeBox(3,4,5) cube2 = Part.makeBox(1,1,1) shape1 = cube1.cut(cube2) shape1.ShapeColor = (0.33,0.67,1.00) -> AttributeError: 'Part.Shape' object has no attribute 'ShapeC...
by ORE
Fri Oct 19, 2018 3:44 pm
Forum: Python scripting and macros
Topic: First steps with API not working
Replies: 4
Views: 798

Re: First steps with API not working

Congratulation for post # 6000! Wow - that's a lot! Mine was post # 1 :lol:

And - thanks for the quick help! Tried cube.exportStep and it works just fine! :D
by ORE
Fri Oct 19, 2018 2:58 pm
Forum: Python scripting and macros
Topic: First steps with API not working
Replies: 4
Views: 798

First steps with API not working

I am trying my first steps with the Python API (I dont want to use the GUI) but so far it does not work. Here is what I am trying to do: import Part cube = Part.makeBox(3,4,5) __objs__=[] __objs__.append(cube) Part.export(__objs__,"C:/Users/ORE/Desktop/2.stp") del __objs__ Everything works...