Macro Repro Wire

From FreeCAD Documentation
Revision as of 18:45, 24 October 2015 by Mario52 (talk | contribs) (Created page with "==Description== Cette macro crée une copie de l'arête, face, objet ou sous objet sélectionné.")

File:Macro ReproWire Macro_ReproWire

Description
Cette macro fait une copie de l'objet ou subObjet sélectionné.

Auteur: Mario52
Auteur
Mario52
Téléchargement
None
Liens
Version Macro
1.0
Dernière modification
None
Version(s) FreeCAD
None
Raccourci clavier
None
Voir aussi
None

Description

Cette macro crée une copie de l'arête, face, objet ou sous objet sélectionné.

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?


Other languages: