edit imported eeschema svg graphics

Started by hidden layer, March 20, 2021, 01:47:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hidden layer

Hi again,
hope you're well

I'm importing svg I got from Eeschema-plot (this is part of Kicad for making PCBs).
There's a lot of memoryconsuming stuff inside I want to get rid of.

is there any exiting example how to either edit Eeschema or edit in visio?

I'll solve this and maybe have some question but... ist there any...

There's some success:
For i = 1 To 10
    ActiveWindow.SelectAll
    On Error Resume Next
        ActiveWindow.Selection.Ungroup
        ActiveWindow.DeselectAll
Next i

cheers
hl

wapperdude

That's a very specific export from Kicad.  Can you upload a small Visio sample?  Can you explain in more detail what you're ultimately trying to achieve?  Visio is not intended to be an file editor.  Have you explored other Kicad export options...pdf?  Can you select and limit info that is exported?

Visio 2019 Pro

hidden layer

#2
Hi wapperdude,
as many 'electricians' work with Visio I thought it was as common as a MS product can be ;)
There are no other export options. the finished PCB layout is available with many options but Eeschema unfortunately not.

What I want to achieve:
There are lot of shapes. After ungrouping I want to make their characters visible

I tried
For Each shp In vsBlatt.Shapes
        shp.CellsSRC(visSectionCharacter, 0, visCharacterColorTrans).FormulaU = "33"
    Next

(recorded code)

but the value in this cell remains zero (%).

What I forgot?

edit: I forgot the % - charcter within the quotes.

now i want to get rid of some shapes if certain conditions are true or not.

stay tuned


hl

wapperdude

Have you successfully tried to manually change the text visibility?  If it is Visio recognizable text, you ought to be able to control it from the Text editing feature on the ribbon...color, font, visibility, etc.

Being common product, which Visio really isn't in terms of Office Products, doesn't make it a universal file editor.  SVG is a graphic file type.  Visio can read it, but conversion is very rudimentary.  There is no shape structure, no way to establish a correspondent Visio shape. 

Anyway, not at my computer, 2 things to try, assuming you're really dealing with text...
1) it might be a syntax thing, for that cell, perhaps "33 %" or some variation.
2) use macro recorder to capture manual entry of value in shapesheet.  This might reveal the needed syntax for the value.



Visio 2019 Pro

hidden layer

Hi,
the background is the following: These SVG contain all text in two formats: plain text and graphical lines for producing /plotting PCB.
The size of these lines is two third of the overall svg.

With this code:
For Each vsBlatt In Application.ActiveDocument.Pages
        Set vsBlatt = ActivePage
    For Each shp In vsBlatt.Shapes
        On Error Resume Next
        shp.CellsSRC(3, 0, 17).FormulaU = "10%" 'Char.ColorTrans
        On Error Resume Next
        shp.CellsSRC(1, visRowFill, 6).FormulaU = "80%"
        On Error Resume Next
        If (shp.CellsSRC(1, 2, 1).ResultIU = 24 Or _
            shp.CellsSRC(1, 2, 1).ResultIU = 0) And _
            shp.CellsSRC(1, 1, 3).ResultIU < 0.05 And _
            shp.CellsSRC(1, 1, 2).ResultIU < 0.04 Then
            shp.Delete
        End If
        On Error Resume Next
        If shp.CellsSRC(1, 2, 1).ResultIU = 25 Then
            shp.Delete
        End If
    Next
Next vsBlatt

I get rid of all these "texts". everything else do not match the requirements. that's it.

The funny thing is when I run this code once some "text" disappears. Run the script once more some more "Text" disappears.
I have to run it 7 times until the last disappears. ok, some disappeare not at all because of one value, but they are very few.

what is going on here?

I didn't found another cell yet whose property is significant enough. But the time I loose while working with 80MB-visio file made it up.

I'll inform about a better way (if there is one).

cheers
hl

hidden layer

Hi wapperdude,
yes, i did record the code.

The result was just 33

After I found this code:
Public Sub DebugPrintCellProperties()
'Abort if ShapeSheet not selected in the Visio UI
    If Not Visio.ActiveWindow.Type = Visio.VisWinTypes.visSheet Then
        Exit Sub
    End If
Dim cel As Visio.Cell
    Set cel = Visio.ActiveWindow.SelectedCell
'Print out some of the cell properties
    Debug.Print "Section", cel.Section
    Debug.Print "Row", cel.Row
    Debug.Print "Column", cel.Column
    Debug.Print "Name", cel.Name
    Debug.Print "FormulaU", cel.FormulaU
    Debug.Print "ResultIU", cel.ResultIU
    Debug.Print "ResultStr("""")", cel.ResultStr("")
    Debug.Print "Dependents", UBound(cel.Dependents)
'cel.Precedents may cause an error
On Error Resume Next
    Debug.Print "Precedents", UBound(cel.Precedents)

I saw that there's some % needed.

I also used dxf export (with 3D-program) but then the texts are not there at all. So with Visio I can not only edit the svg but also program dependencies (cross references). With Eeschema I didn't found a way to do so.

cheery
hl

hidden layer

#6
Hi there,
wapperdude, you gave me the right direction - thanks!
editing the layers properties in Eeschema makes it easy to detect parts that shall be deleted.
edit: the layer's color is the only accessible /edit

I only wonder why it takes some loops to delete all of them.
10 loops make 4MB out of 18MB - that's worth it!

nice Sunday
hl