# SVG properties - modifying after import

**URL:** <https://discourse.processing.org/t/svg-properties-modifying-after-import/2028>\
**Category:** Coding Questions\
**Created:** [July 23, 2018, 9:57pm UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028 "2018-07-23T21:57:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pxlmnkeee](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/pxlmnkeee/32/864_2.png) [@pxlmnkeee](https://discourse.processing.org/u/pxlmnkeee)\
**Post date:** [July 23, 2018, 9:57pm UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028/1 "2018-07-23T21:57:37Z")

</div>

I’m using the Python mode in Processing, but I’m guessing this might be an issue in other processing modes as well:

I’ve imported some SVGs exported from Illustrator (as well as other hand coded SVGs) and I’m having problems changing the strokeWeight on the characters. Here is my test code:

```auto
import os

def setup():
    size (500,500)
    background(255)
    
    svgPath = os.path.expanduser('~/Documents/Processing/scratchpad/data/')
    fileName = 'svgTest.svg'
    filePath = os.path.join(svgPath,fileName)
    theShape = loadShape(filePath)
    stroke(255,255,255)
    strokeWeight(15)
    shape(theShape,10,10)

```

Here is my simple SVG that Processing opens and displays without problem. I have been using several other SVGs for testing as well to make sure the file itself is not introducing a complication.

```auto
<svg xmlns="http://www.w3.org/2000/svg">
	<line
		x1="40" y1="30"
		x2="240" y2="100"
		stroke="black" stroke-width="1" />
</svg>

```

My strokeWeight does nothing to change the appearance of the SVG shapes I’m bringing in. Wondering if anyone has similar (or opposite!) experiences?

---

<div class="post-metadata">

**Author:** ![WakeMeAtThree](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wakemeatthree/32/38_2.png) [@WakeMeAtThree](https://discourse.processing.org/u/WakeMeAtThree)\
**Post date:** [July 23, 2018, 10:02pm UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028/2 "2018-07-23T22:02:17Z")

</div>

Hi pxlmnkeee!  
Try using the `disableStyle()` method to be able to change the settings for the shape. That should fix your issue. I’ve included it in your code as follows:

```python
import os

def setup():
    size (500,500)
    background(255)
    
    svgPath = os.path.expanduser('~/Documents/Processing/scratchpad/data/')
    fileName = 'svgTest.svg'
    filePath = os.path.join(svgPath,fileName)
    theShape = loadShape(filePath)
    
    #Disable svg style
    theShape.disableStyle()
    
    stroke(0,0,0)
    strokeWeight(15)
    shape(theShape,10,10)

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 24, 2018, 4:09am UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028/3 "2018-07-24T04:09:52Z")

</div>

> [@pxlmnkeee](#):
>
> ```auto
> svgPath = os.path.expanduser('~/Documents/Processing/scratchpad/data/')
> fileName = 'svgTest.svg'
> filePath = os.path.join(svgPath,fileName)
> theShape = loadShape(filePath)
> 
> ```

If you place your file “svgTest.svg” inside your sketch’s folder or its subfolder “data/”, PApplet::**loadShape()** method will find it w/o any those os shenanigan boilerplate! 🤞

---

<div class="post-metadata">

**Author:** ![pxlmnkeee](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/pxlmnkeee/32/864_2.png) [@pxlmnkeee](https://discourse.processing.org/u/pxlmnkeee)\
**Post date:** [July 24, 2018, 2:51pm UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028/4 "2018-07-24T14:51:21Z")

</div>

> [@WakeMeAtThree](#):
>
> theShape.disableStyle()

YES! That was the nugget I was looking for. I had seen it mentioned in another unrelated post, but didn’t think style would apply since I wasn’t setting a style explicitly in the SVG itself.

Thanks for the tip!!

---

<div class="post-metadata">

**Author:** ![pxlmnkeee](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/pxlmnkeee/32/864_2.png) [@pxlmnkeee](https://discourse.processing.org/u/pxlmnkeee)\
**Post date:** [July 24, 2018, 2:54pm UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028/5 "2018-07-24T14:54:07Z")

</div>

Thanks GoToLoop! I’m going to have hundreds of SVG files so I’ve built a folder structure in the data folder to keep things organized. I just left the os boilerplate code in there. I’m trying to get in the good habit of using os subroutines to work with file paths, and I’ve had problems accessing things directly in the data folder in Processing’s Python mode.

Thanks for looking out, always appreciated!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 24, 2018, 3:00pm UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028/6 "2018-07-24T15:00:27Z")

</div>

Some tips for loading assets in Python Mode: 🐍

> **[How to check if a file is exist in data folder by code?](https://Discourse.Processing.org/t/how-to-check-if-a-file-is-exist-in-data-folder-by-code/589/7?u=gotoloop)**
>
> Yes! Just pass an empty string "" to dataPath(): dataFolderPath = this.dataPath('') + '/' print dataFolderPath … or to dataFile(): dir = this.dataFile('') dataFolderPath = dir.path + '/' print dataFolderPath However, if you need all files within...

---

<div class="post-metadata">

**Author:** ![WakeMeAtThree](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/wakemeatthree/32/38_2.png) [@WakeMeAtThree](https://discourse.processing.org/u/WakeMeAtThree)\
**Post date:** [July 24, 2018, 3:28pm UTC](https://discourse.processing.org/t/svg-properties-modifying-after-import/2028/7 "2018-07-24T15:28:45Z")

</div>

I’m sort of using a similar approach with os module. I have noticed that any time you make a change in the Processing IDE for Python mode, your sketch path switches to a temp folder. When you save after a code change, then your sketch path goes back to the one that has data folder. It’s usually an issue for my workflow, as I don’t like saving after every code change. Your existing code manages to skip the hassle of saving by setting a universal path for your data, which is great.
