It's a very simple question from a beginner.
How to create a clone object with a desired name? I mean a name that can be used in form:
FreeCAD.ActiveDocument.<a clone's name>
Give a script example, pls.
How to create a clone object with a desired name?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 32
- Joined: Fri Apr 10, 2015 1:56 am
How to create a clone object with a desired name?
Дедушка Мороз, (если ты есть) пусть в новом году FreeCAD не будет таким глюкодромом. Хотя бы для Part / PartDesign! Ну хотя бы чтобы булеаны не глючили! Кроме как на тебя надеяться, видимо, больше не на кого ...
Re: How to create a clone object with a desired name?
hi
see How to recognize Draft Clone objects?
mario
Code: Select all
import Draft
sel = FreeCADGui.Selection.getSelection() # select object
obj = Draft.clone(sel[0]) # create a clone selected object
obj.Label = "tyty" # give a Label
#Data
print App.activeDocument().getObjectsByLabel("tyty")[0].Scale # search by label (Data)
#View
print App.activeDocument().getObjectsByLabel("tyty")[0].ViewObject.Visibility # search by label (View)
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
-
- Posts: 32
- Joined: Fri Apr 10, 2015 1:56 am
Re: How to create a clone object with a desired name?
I need to choose a Name not Label for a clone. It is easy when create an object by addObject method. But I don't know how to choose name (not label) for a clone.
Дедушка Мороз, (если ты есть) пусть в новом году FreeCAD не будет таким глюкодромом. Хотя бы для Part / PartDesign! Ну хотя бы чтобы булеаны не глючили! Кроме как на тебя надеяться, видимо, больше не на кого ...
Re: How to create a clone object with a desired name?
There is no way to do that at once, but you can simply mimmick the code inside Draft.clone (src/Mod/Draft/Draft.py line 2827), and first create the object yourself then apply _Clone to it.