Macro ReproWire/it

(Redirected from Macro ReproWire/it)

Macro ReproWire.png Replica un componente

Descrizione
Questa macro crea un duplicato di un sottoelemento subObject ... selezionato.
Autore
Mario52
Link
Esempi di macro
Come installare le Macro
Personalizzare la barra degli strumenti
Versione
00.01
Data ultima modifica
2015-10-24


Descrizione

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

ReproWire


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 codecs   #https://docs.python.org/2/howto/unicode.html
import Part,Draft
#
#__title__="Macro_ReproWire"
#__author__ = "Mario52"
#__url__     = "http://www.freecadweb.org/index-fr.html"
#__version__ = "00.01"
#__date__    = "24/10/2015"
#

sel = Gui.Selection.getSelection()
s   = Gui.Selection.getSelectionEx()

try:
    if len(sel) != 0:
            print "Object(s) : ", len(sel), " , SubObject(s) : ", len(s)
            i2 = ii2 = -1 
            for i in s:
                i2 += 1
                ii2 = -1
                try:
                    FreeCADGui.Selection.getSelectionEx()[i2].SubObjects[ii2]
                    for ii in i.SubElementNames:
#                        print "SubObject"
                        ii2 += 1
                        Part.show(FreeCADGui.Selection.getSelectionEx()[i2].SubObjects[ii2].copy())   # create repro shape subObject
                        print i2+1 ,"/", ii2+1 ,"/", len(s) ," ", i.ObjectName ," ", ii               # display the info SubObject
                        a = App.ActiveDocument.ActiveObject
                        #    object Name  / original object Name / SubObject Name
                        a.Label = a.Name + " " + i.ObjectName + " " + ii                              # Label 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
                except Exception:
#                    print "Not SubObject"
                    Part.show(sel[i2].Shape)                                                          # create repro shape object
                    print i2+1 ,"/", ii2+1 ,"/", len(s) ," ", sel[i2].Name                            # display the info SubObject
                    a = App.ActiveDocument.ActiveObject
                    #        object Name  /  original object Name
                    a.Label =a.Name + " " +  sel[i2].Name                                             # Label 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 "Unexpected error" 

Versione

00.01 24/10/2015 :

00.00 22/10/2015 :

Link

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


Online version: "http://www.freecadweb.org/wiki/index.php?title=Macro_Repro_Wire/it&oldid=240721"

Navigation menu