# Copy properties of a source to another source programmatically depending on user input

**URL:** https://discourse.paraview.org/t/copy-properties-of-a-source-to-another-source-programmatically-depending-on-user-input/3393
**Category:** ParaView Support
**Tags:** python
**Created:** [January 23, 2020, 10:41pm UTC](https://discourse.paraview.org/t/copy-properties-of-a-source-to-another-source-programmatically-depending-on-user-input/3393 "2020-01-23T22:41:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [January 23, 2020, 10:41pm UTC](https://discourse.paraview.org/t/copy-properties-of-a-source-to-another-source-programmatically-depending-on-user-input/3393/1 "2020-01-23T22:41:16Z")

</div>

I want to copy the properties of some sources x1, x2,…,x5 to other sources y1,y2,…,y5 programmatically depending on user input.

The user chooses X, so instead of copying by hand the properties of x1 to y1, x2 to y2, etc. I want to do a macro or something that lets me do this automatically. But I can’t pass arguments to macros, right?

Is there a way to do this?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 24, 2020, 4:07am UTC](https://discourse.paraview.org/t/copy-properties-of-a-source-to-another-source-programmatically-depending-on-user-input/3393/2 "2020-01-24T04:07:04Z")

</div>

Not sure to follow. When you say 'User Choose X", do you mean in the interface or in python ?

---

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [January 24, 2020, 9:55am UTC](https://discourse.paraview.org/t/copy-properties-of-a-source-to-another-source-programmatically-depending-on-user-input/3393/3 "2020-01-24T09:55:49Z")

</div>

I’m sorry. For example, the person using Paraview, depending on what he sees in the view, has to choose b or c.

If he chose b, then he has to paste **b\_InitialPosition** to **a\_InitialPosition** and **b\_TranslateToOriginAndScale** to **a\_TranslateToOriginAndScale**.

If he chose c, then he has to paste **c\_InitialPosition** to **a\_InitialPosition** and **c\_TranslateToOriginAndScale** to **a\_TranslateToOriginAndScale**.

![Screen Shot 2020-01-23 at 19.33.24](https://discourse.paraview.org/uploads/default/original/2X/3/38012a490e7baed63a7624a85e0b840d522c8963.png)

I want to do something that, with a couple of clicks, copy the properties of b or c and paste them into a. I thought of a macro, but how can I tell the maco which option the user chooses?

---

<div class="post-metadata">

### Author: ![majo\_vlas](https://discourse.paraview.org/user_avatar/discourse.paraview.org/majo_vlas/32/2567_2.png) [@majo\_vlas](https://discourse.paraview.org/u/majo_vlas)
#### Post date: [January 24, 2020, 11:54pm UTC](https://discourse.paraview.org/t/copy-properties-of-a-source-to-another-source-programmatically-depending-on-user-input/3393/4 "2020-01-24T23:54:32Z")

</div>

How I did it:

First, I realized that every case was different. Every filter has its own properties.

For example, copying the properties of un transform to another transform.

```auto
transform1 = Transform(Input=transform)
sphere = FindSource("Sphere")

# Copy the properties of the trajectory selected to 
transform1.Transform.Translate = sphere.Transform.Translate
transform1.Transform.Scale = sphere.Transform.Scale
transform1.Transform.Rotate = sphere.Transform.Rotate

```

or from a slice to another slice

```auto
slice1 = FindSource("Slice1")
slice2 = Slice(Input=transform2)

slice2.SliceType.Origin = slice1.SliceType.Origin
slice2.SliceType.Normal = slice1.SliceType.Normal

```

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 27, 2020, 4:00am UTC](https://discourse.paraview.org/t/copy-properties-of-a-source-to-another-source-programmatically-depending-on-user-input/3393/5 "2020-01-27T04:00:24Z")

</div>

If your filter are the same, you can simply use the copy paste mechanism.  
(only in the GUI, not in python)

If not, as you realized, it would requires specific n-n mapping.
