Macro Replica un componente

From FreeCAD Documentation
Revision as of 19:48, 24 October 2015 by Renatorivo (talk | contribs) (Created page with "==Link== Nel forum [http://forum.freecadweb.org/viewtopic.php?f=3&t=12922 are there any tools to extrude only selected surface from a sketch?]")

File:Macro ReproWire Macro_ReproWire

Descrizione
Questa macro crea un duplicato di un sottoelemento subObject ... selezionato.

Autore: Mario52
Autore
Mario52
Download
None
Link
Versione macro
1.0
Data ultima modifica
None
Versioni di FreeCAD
None
Scorciatoia
Nessuna
Vedere anche
Nessuno

Descrizione

Questa macro crea un duplicato di un subObject, faccia, contorno o linea, selezionato.

Uso

Selezionare l'oggetto e poi eseguire la macro per creare la sua copia. È possibile usare la copia per produrre delle estrusioni o altre ordinarie operazioni.

Le copie sono di colore rosso e denominate "Shapexxx + il nome dell'originale".

Script

Macro_ReproWire.FCMacro l'icona per la barra degli strumenti 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"

Versione

00.00 24/10/2015 :

Link

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


Other languages: