Is there any Kicad plug-in for Microsoft Word / Github MarkDown?

Hello everyone!

The idea is as follows: I want to have a set of schematics related to a certain topic as a document (Word / Libre Office / Markdown note or other stuff) because I can use links to sources (web page, book, journal/magazine, etc.) and comments with some calculation formulas.

I know, some types of files allow themself to be inserted in Word Document as objects (per say, chemical formulas from ChemOffice, etc.), rendered within document as an image, and with double-click on it to be edited in the appropriate software. At the same time it is stored on the hard drive as an actual file of that type.

Is there anything like that for KiCad schematics?

UPD: Just to clarify what result I would like vs how it is now:

In Microsoft Word you can insert files as objects via: InsertObjectObjectsCreate from File and click Link to file.

In LibreOffice Writer it is achievable via: InsertOLE ObjectCreate From File → and also select Link to FIle

I’m not exactly sure what you want to do but, perhaps this will help… I placed the Text into Schematic…

Kicad has a couple of Text Input Tools and they include a Link field. Just set the file to be linked… Afterwards, Clicking the Link opens the Text document (or, other doc type)…

I want to do exactly the opposite: insert KiCad schematic as an object to a Word Document.

That’s not about Kicad, that’s about your Word Document. And, the answer is ‘Yes’ Word and Libre can have file links… I’m sure there are plenty of info resources online…

Currently, it can be inserted as a link, but not as a schematic:

I don’t remember if Word can do it but, I suspect ‘Yes’. Libre can do it, video below shows:

• A link (big button)
• An Image
• A Link (actionable)

See video below (again, this all about Non-Kicad software…)

Note: The Kicad ‘Error’ popup is because I never bother to update the Page-template, has nothing to do with opening the link…

Thank you for your effort, but none of those options is what I’m looking for.

I’m looking for an option to render schematics-file within the Work document while keeping the link for external schematics openable in KiCad. Please, see the screenshot of a document above.

I understand now. I’ll think about it…

EDIT: Okay, I thought about it… Simple (for me to do in LibreOffice_Document) just create a Macro that does all the steps and assign an Icon to the Macro. The Macro can include: asking for a file, and/or opening specific file then setting it into an Image field ; a One-Click and you’re done thing!

I’ve done this several times prior to my ‘just updating Libre’ but, updating Reset my toolbars and I don’t want to mess with it now.

To help automate the Macro creating process, you can do Tools>Macro>Record and do all the required steps. Then, Edit the Macro (it’s editable inside Libre)… Will require some Learning but, easy to do… If I get around to re-setting my Toolbars I’ll jimmy-up an example but, I have a Gig to play today so, I’m out for the rest of the day…

I have done a few experiments with Asciidoc (similar to markdown). I’ve written some “rich text” with a text editor (Markdown is also supported in posts in this forum, but that’s another topic) and I installed a plugin in Firefox so it can directly interpret markdown (asciidoc? (I mix those up a bit)). When I saved the file in my text editor, Firefox immediately loads the new version, so apparently it watches for file changes. I guess you can also edit files in firefox these days, so you could probably do it all in a web browser.

I used Word once or twice (writing 50 page documents for school) and back then (15 years ago?) it was very buggy, even though it already was on the market for 20 years, and I came to dislike it a lot (quite common for microsoft products).

Not wanting to revisit this later and having extra 10 minutes, I rushed through this… Shows Exporting Schematic from Kicad then, One-Click pasting into Document.

Then, (having nothing to do with the Screenshot because I don’t have time), I clicked a Macro (created as indicated in previous post) to load a Screenshot/Image… I could have edited the Macro to prompt for desired image but, I left it to grab the default I set it to when creating the Macro…

Notice clicking the Icon at Top_Right

good luck…

There are several more programs Splan, scribus

I use KiCad for the experiment schematics / setup drawings in my test plans. Those documents are basically boring long work instructions for automotive component validations and are used to agree on any detail of testing between us and our customers. Thanks to our process definition, those documents need to be written in word (which is sometimes really a pain in the a… when documents get too long).

Still, I had good experience with exporting the setup schematics as svg vector graphics in KiCad (you get one svg file per page) and then creating a link to the specific svg of the desired page in word. Due to the link, updating is also easy even tough there is no native KiCad support in word.

SVG export is also possible with kicad-cli. The main advantage of svg over bitmaps (what you get when you export to Clipboard, etc.) is, that the vector graphic actually contains all lines and is still sharp when zooming in in the final pdf.

Thank you. I was thinking of something like that as an option.

So far I’ve got this “workaround”: a folder with structure:

- notes (folder)
--> kicad_src (folder)
--> images (folder)
--> docs (folder)
--> convert_kicad_to_svg.ps1 (PowerShell script)

The content of PowerShell script is:

$SourceFolder = Join-Path -Path "$PSScriptRoot" -ChildPath "kicad_src"
$ExportFolder  = Join-Path -Path "$PSScriptRoot" -ChildPath "svg_export"

Write-Host "$SourceFolder"
Write-Host "$ExportFolder"

Set-Alias -Name kicad-cli -Value "C:\Program Files\KiCad\8.0\bin\kicad-cli.exe"
Set-Alias -Name inkscape "C:\Program Files\Inkscape\bin\inkscape.exe"

ForEach ($schematics_file in Get-ChildItem -Path "$SourceFolder" -Recurse -Force -Include *.kicad_sch){
	kicad-cli sch export svg "$schematics_file" --output "$ExportFolder" -e -n
	$OutputFile = Join-Path -Path "$ExportFolder" -ChildPath (($schematics_file).BaseName + '.svg')
	inkscape -T -D -o "$OutputFile" "$OutputFile"
}

There is extra involvement of InkScape since KiCad exports the whole page (even when there is the key of no frame), so wanted to crop images.

These images will be later indeed referenced in the Word, etc. and supposed to be auto-updated when document is re-opened.

So far, unclear is inkscape export with margins. It might have been working with command:

# This was supposed to add margin of 2 units of the document (mm or other)
inkscape --export-plain-svg --export-margin=2 --export-area-drawing --export-overwrite "$OutputFile"

but it doesn’t work as of now.

UPD: After some thinking. made some rearrangements:

-> root (Folder)
--> convert_kicad_to_svg.ps1 (PowerShell script)
--> topics (Folder)
---> Topic_1 (folder()
----> document (whaever_extension is needed)
----> kicad_src (folder with Kicad Schematics)
----> kicad_img (folder with Kicad exports)

The content for script is:

$SourceFolderName = "kicad_src"
$ExportFolderName = "kicad_img"

Set-Alias -Name kicad-cli -Value "C:\Program Files\KiCad\8.0\bin\kicad-cli.exe"
Set-Alias -Name inkscape "C:\Program Files\Inkscape\bin\inkscape.exe"

ForEach ($kicad_src_folder in Get-ChildItem -Path "$PSScriptRoot" -Recurse -Force -Directory -Filter "$SourceFolderName") {
	$kicad_export_folder = Join-Path -Path $(Split-Path $kicad_src_folder.FullName -parent) -ChildPath $ExportFolderName

	If(!(test-path -PathType container $kicad_export_folder)) {
		New-Item -ItemType Directory -Path $kicad_export_folder
	}

	ForEach ($schematics_file in Get-ChildItem -Path $kicad_src_folder.FullName -Recurse -Force -Include *.kicad_sch) {
		$OutputFile = Join-Path -Path "$kicad_export_folder" -ChildPath (($schematics_file).BaseName + '.svg')
		kicad-cli sch export svg "$schematics_file" --output "$kicad_export_folder" -e -n
		inkscape --export-plain-svg --export-margin=2 --export-area-drawing --export-overwrite "$OutputFile"
	}
}

This is not exactly what I originally wanted, but is already “auto-updated” if any changes were incorporated to the schematics.

1 Like

Yep, I had the same issue with cropping the SVGs. In my (really specific) application, I resolved the issue by changing the page format. That’s why I did not open a ticket regarding this before. I will check if there already exists a ticket and otherwise I will create one. In the meantime thank you for sharing your script!

For bitmaps and other formats automatic cropping to content at export is already possible (at least in the GUI), so I guess this will be possible with SVGs aswell at some point.

Edit: the ticket was created and is waiting for your upvote here.

1 Like

For bitmaps and other formats automatic cropping to content at export is already possible (at least in the GUI), so I guess this will be possible with SVGs aswell at some point.

where do you export bitmaps with automatic cropping in kicad?