Macro Repro Wire

From FreeCAD Documentation
Revision as of 18:36, 24 October 2015 by Mario52 (talk | contribs) (create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


File:Macro ReproWire Macro_ReproWire

Description
This macro create on duplicate to wire subObject ... selected.

Author: Mario52
Author
Mario52
Download
None
Links
Macro Version
1.0
Date last modified
None
FreeCAD Version(s)
None
Default shortcut
None
See also
None

Description

This macro create on duplicate to wire, face, subObject ... selected.

Use

Select your object and run the macro for create your copy, you can extrude created faces.

The copies are coloured red and renamed with the Shapexxx + original names

Script

Macro_ReproWire.FCMacro the icon for the toolbar icon for the button

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import Part,PartGui

__title__="Macro_ReproWire"
__author__ = "Mario52"
__url__     = "http://www.freecadweb.org/index-fr.html"
__version__ = "00.00"
__date__    = "22/10/2015"

sel = FreeCADGui.Selection.getSelection()                                                            # select one or many objects

try:
    if len(sel) != 0:
        numObj = -1
        for i in range(len(FreeCADGui.Selection.getSelectionEx())):                                  # boucle objects
            for ii in range(len(FreeCADGui.Selection.getSelectionEx()[i].SubObjects)):               # boucle SubObjects (sub objects selected)
                numObj += 1                                                                          # numero of object

                Part.show(FreeCADGui.Selection.getSelectionEx()[i].SubObjects[ii].copy())            # create repro shape

                element_ = FreeCADGui.Selection.getSelectionEx()[i].SubElementNames[ii]              # extract details to display
                #    Object /subObject / number objects total                                        # details
                print i+1 ,"/", ii+1 ,"/", len(sel) ," ", sel[numObj].Label ," ", element_           # display the info
                a = App.ActiveDocument.ActiveObject
                a.Label = a.Name+" "+sel[numObj].Label+" "+element_                                  # name for the repro shape

                try:
                    FreeCADGui.activeDocument().activeObject().LineColor  = (1.0,0.0,0.0)            # give LineColor
                    FreeCADGui.activeDocument().activeObject().PointColor = (1.0,0.0,0.0)            # give PointColor
                    FreeCADGui.activeDocument().activeObject().ShapeColor = (1.0,0.0,0.0)            # give ShapeColor
                except Exception:
                    None
    else :
        print "Select one object"
except Exception:
    print "Wrong selection"

Version

00.00 24/10/2015 :

Links

The forum are there any tools to extrude only selected surface from a sketch?