Outils pour utilisateurs

Outils du site


issue169:inkscape

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
issue169:inkscape [2021/06/05 14:06] d52frissue169:inkscape [2021/06/08 11:44] (Version actuelle) auntiee
Ligne 1: Ligne 1:
-**Many people think that the RPi Pico is great little microprocessor, but because there is no “direct” support for networking, it’s not really worth it, even at its very low purchase price. I asked the MicroPython group if they thought that there was any update on networking support within MicroPython for the Pico, was told thatat this point, there is no plan to provide that support, again due to the lack of networking hardware on the Pico. While I, too, am frustrated at the lack of networking, all is not lost. The Arduino Nano RP2040 is still in development and is supposed to have not only Wifi support, but also bluetooth, and 9-axis IMU, and a microphone that should also support MicroPython. I’m guessing that it should be available in the next month or so, but we still don’t know how much it’s going to cost. For now, a couple of options are already available.**+**There are still number of changes and new features in Inkscape version 1.0 which haven’t covered over the past few months. In order to get through as many new features as can, this month I’m going to take whistle-stop tour of some of the smaller features which don’t necessarily require complex examples to demonstrateHold on to your hats!**
  
-**Just as an aside, in late April, 2021, the latest firmware for the RPi Pico, ESP8266, and the ESP32, is now at level 1.15You can now download the latest firmware at https://micropython.org/download/. That having been saideverything presented this month will work on level 1.14. A list of changes to the various ports can be found at https://github.com/micropython/micropython/releases/tag/v1.15.+Il y a encore un certain nombre de changements et de nouvelles fonctionnalités dans la version 1.0 d'Inkscape que je n'ai pas couverts au cours des derniers moisAfin d'aborder autant de nouvelles fonctionnalités que possibleje vais ce mois-ci faire un tour d'horizon de quelques-unes des plus petites fonctionnalités qui ne nécessitent pas nécessairement des exemples complexes pour être démontréesAccrochez-vous !
  
-As I mentioned last month, the ESP-01 WiFi module is available, but so far, I haven’t been able to get it to work well enough to really suggest it. I’m still trying to get somewhere with it but have made only limited progress.+**Y-Axis inversion
  
-The good folks at Adafruit have small networking coprocessor called the AirLift that will allow the Pico to connect to the internet and do just about anything that you needYou have to use CircuitPython on the Pico, but the project works well. You can find this project at https://learn.adafruit.com/quickstart-rp2040-pico-with-wifi-and-circuitpython .**+I’ve said this before, and no doubt I’ll say it again: Inkscape is not CAD program, despite offering some CAD-like features. Nevertheless, it has historically behaved the same way as most CAD programs – and even traditional paper-and-pen technical drawing – with regard to the position and orientation of its y-axisPrevious versions of Inkscape placed the origin (the 0, 0 point) at the bottom-left of the canvas, with the positive direction of the y-axis going upwards.
  
-**I have tried this project and it works and works wellThere are two big drawbacks for mehowever. First, is that the project must be done under CircuitPythonThe second is that the AirLift is about twice the price of the RPi Pico.+If you come from a CAD, drafting or graphing background, this may seem perfectly sensible. But Inkscape is really an SVG editor, and SVG is a product of the web world. Web pages grow from the top downwards. Add some more paragraphs to your HTML page and the browser simply extends the scroll bar to let you reach themSVG works in the same waywith its origin at the top-left of the drawing area (i.e. the browser window), and the positive direction of the y-axis going downwards.
  
-If you want a pure MicroPython solution that is less expensive, you are NOT out of luck. There is a project by some of the MicroPython developers that fills the billYou can find the repository at https://github.com/peterhinch/micropython-mqtt. Basicallyyou use the RPi Pico and connect it to ESP8266 via a 5-wire (plus 5Vdc and ground) interface. This allows the Pico to run things like temperature sensor and report the data via the Internet to a MQTT server (broker)either local or hosted on the Internet. When I found this (thanks to the MicroPython group), I dropped everything and pulled an ESP8266 NodeMCU board that I purchased shortly after I got the RPi Pico. You can find various ESP8266 boards on the Internet for around $6.00 USD, which makes it reasonably priced option.**+This mismatch between Inkscape’s on-screen behaviour and the requirements of the SVG format meant that the coordinates of points viewed in the program would be different to the values that were actually stored in the fileFor most usersthis wasn’t problem, but when using Inkscape to produce graphics that will ultimately appear on web page, this mismatch could make life unnecessarily difficult, especially when trying to write JavaScript to dynamically alter the file within web browser.
  
-**Project of the month+With v1.0, Inkscape now defaults to the SVG standard for its origin and y-axis direction. Should this cause you any problems or confusion, you can revert to the previous behaviour by un-checking the “Origin in upper left with y-axis pointing down” setting in the Interface panel of the Edit > Preferences dialog. 
 +**
  
-So we’ll use this as the project of the month. This project will be broken down into multiple parts, the first will be to use the internal temperature sensor on the Pico to get the temperature, then we’ll set up the ESP8266 board and connect it to the Pico, and finally we’ll send the data via the Internet to a MQTT server. I’ll explain two server options, one based on a local Raspberry Pi computer, and one going to a free Internet server. When we are done, you will know how to use the internal temperature sensor and how to get that data to a MQTT server.**+Inversion de l'axe des Y
  
-**Part 1 RPi Pico Temperature sensor+Je l'ai déjà dit et je le répéterai sans doute : Inkscape n'est pas un programme de CAO, bien qu'il offre certaines fonctionnalités similaires à la CAO. Néanmoins, il s'est historiquement comporté de la même manière que la plupart des programmes de CAO et même que le dessin technique traditionnel à la plume - en ce qui concerne la position et l'orientation de son axe des ordonnées. Les versions précédentes d'Inkscape plaçaient l'origine (le point 0, 0) en bas à gauche de la toile, la direction positive de l'axe des y allant vers le haut.
  
-The first logical step is to write a test program that will read the internal temperature sensor on the PicoWe can access the sensor through the ADC (Analogue-to-Digital Converterbuilt into the Pico. ADC? Yes. The Pico actually has four ADC optionsthree available on the GPIO pins, and one internal that is dedicated to the temperature sensor. These are all 12-bit converters+Si vous venez d'un environnement de CAO, de dessin ou de graphisme, cela peut sembler parfaitement raisonnableMais Inkscape est en réalité un éditeur SVG, et le SVG est un produit du monde du Web. Les pages Web se développent du haut vers le bas. Ajoutez quelques paragraphes supplémentaires à votre page HTML et le navigateur étend simplement la barre de défilement pour vous permettre de les atteindre. SVG fonctionne de la même manière, avec son origine en haut à gauche de la zone de dessin (c'est-à-dire la fenêtre du navigateur), et la direction positive de l'axe des y va vers le bas.
  
-Using an ADC is really very easyWe provide a voltage into one of the pins – which comes in as a 16-bit unsigned integer – which will be a number from 0 to 65,535. In theorythe value becomes 0 for no voltage and 65,535 for the full 3.3 volts. Please be sure that your maximum voltage going into the ADC is 3.3 volts DC. Otherwiseyou will overload the system and cause the magic blue smoke to escapeThis will render the Pico non-functional!**+Ce décalage entre le comportement d'Inkscape à l'écran et les exigences du format SVG signifiait que les coordonnées des points visualisés dans le programme étaient différentes des valeurs effectivement stockées dans le fichierPour la plupart des utilisateursce n'était pas un problèmemais lorsqu'on utilisait Inkscape pour produire des graphiques qui apparaîtraient finalement sur une page Webce décalage pouvait rendre la vie inutilement difficilesurtout lorsqu'on essayait d'écrire du JavaScript pour modifier dynamiquement le fichier dans un navigateur Web.
  
-**While this is a nice way to view the range of voltages, and 65,535 is an easy way to visualize the fact that you are receiving the full 3.3 voltsit doesn’t quite relate in most people's mindsSowe can apply a little math to convert that value into a value that shows the “actual” voltage being applied to the pin. Since we know that the maximum voltage is 3.3 volts, and we know that when that voltage is applied to the pin, the ADC will respond with 65,535 at that voltage, we can simply create a conversion factor by dividing 3.3 by 65,535. Now we can see the actual voltage being applied to the ADC input pin. Let’s test this by taking 65,535 and multiplying it with (3.3 / 65535). That gives us 0.000050355 per unit. So if we have an input of 65535 and we apply our conversion factor, we will get 3.3Amazing!+Avec la v1.0Inkscape utilise désormais par défaut la norme SVG pour son origine et la direction de l'axe des ySi cela vous cause des problèmes ou de la confusionvous pouvez revenir au comportement précédent en décochant le paramètre « Origine en haut à gauche avec l'axe des y pointant vers le bas » dans le panneau Interface de la boîte de dialogue Édition > Préférences.
  
-So we now know that the temperature sensor within the Pico returns an integer that we can use to get the temperature value. However, there is another formula that is specific to the Pico to get our final value. That formula is: 
  
-temperature = 27 - (reading - 0.706) / 0.001721**+**Duplicating guides
  
-**Where reading is our ADC value with the conversion factor appliedSo assuming the average temperature inside of our house ranges between 22-24 degrees Centigrade, we can assume that our voltage value should be somewhere between 0.7139803 and 0.7107576 (22.36296 and 24.23554 C). The actual voltage reading has a tiny variance. Due to this, many factors can cause the reading to vary quite a bit. Some of this could be due to variance in the voltage provided to the Pico. Many people have commented on the temp sensor in the Pico not being very stableFor our purposes (at least here)it will do us well. I’m sorry for the long dissertation on the way that the ADC works, but I felt you should know.+Version 1.0 introduces a means of duplicating an existing guide line. The behaviour of this differs between v1.0.and the release candidate for version 1.(the full version of which may have even been released by the time this magazine is published)Let’s look at v1.0 firstwhere the change is rather frustrating and unintuitive.
  
-So, let’s code our test programFirstas alwayswe need to import the needed libraries...+There’s a new “Duplicate” button in the Guideline dialog (opened by double-clicking on an existing guide)This duplicates the current guidein-placethen closes the dialog. No other changes are made to the duplicate, regardless of what other parameters you set in the dialogThis can easily lead to confusion as it’s not always obvious that there are now two co-positioned guidelinesDouble-clicking on the lines will open the dialog again, where you can make changes that will affect one of them.**
  
-import machine +Duplication des guides
-import utime**+
  
-**Now we set up which ADC we will be using (remember, the temperature sensor is ADC # 4and our conversion factor:+La version 1.0 introduit un moyen de dupliquer une ligne de guide existante. Le comportement de cette fonction diffère entre la v1.0.x et la version candidate à la version 1.1 (dont la version complète pourrait même être sortie au moment de la publication de ce magazine). Examinons d'abord la v1.0, où les changements sont plutôt frustrants et peu intuitifs.
  
-sensor_temp = machine.ADC(4)+Il y a un nouveau bouton « Dupliquer » dans la boîte de dialogue des guides (ouverte par un double-clic sur un guide existant). Cela duplique le guide actuel, en place, puis ferme le dialogue. Aucune autre modification n'est apportée à la duplication, quels que soient les autres paramètres définis dans la boîte de dialogue. Cela peut facilement prêter à confusion car il n'est pas toujours évident qu'il y a maintenant deux lignes directrices superposées. En double-cliquant sur les lignes, vous ouvrirez à nouveau la boîte de dialogue, où vous pourrez apporter des modifications qui affecteront l'une d'entre elles.
  
-conversion_factor = 3.3 / (65535) 
  
-We enter “forever” loop (see above): read the temp sensorapply the conversion factor, then apply the magic formula to get the temperature in CentigradeWe print the temperature into the console, and then sleep for 2 seconds before doing it all again(If you can’t think in Centigrade, then apply the formula to convert to Fahrenheit).+**Suppose, therefore, that you have horizontal guideline and you wish to create two more parallel guidelineswith 10mm spacing between them. Here are the steps: 
 +•  Double-click on the existing line to bring up the Guideline dialog. 
 +•  Click the Duplicate button. The dialog closes. 
 +•  Double-click on the newly duplicated line (which is on top of the existing line) to open the dialog again. 
 +•  Enter 10mm into the “Y” field, check the “Relative change” box, and click the OK buttonThe dialog closes, but you now have two guides on the page, separated by 10mm. 
 +•  Repeat all four steps, but starting with your newly duplicated and moved line.
  
-If you wishyou can certainly add display (like we did last month) to provide the reading without having to have Thonny (or your IDE of choice) visible all of the time.+Although the “Relative change” box remains checked between stepsthe value in the “Y” field is cleared. This makes it frustrating to create series of equally spaced guides. If you forget to click the “Duplicate” button before you change the value, you’ll end up moving your original guide by mistake. No amount of hitting Ctrl-Z will undo that mistake: you’ll have to reopen the dialog and move the guide by the opposite amount to get it back to where it started.
  
-Now that we have that donelet’s move on to downloading the MQTT software project.**+Fortunately this feature has been improved in the 1.1 release candidate. In that version you simply open the dialog, put in your relative changethen press Duplicate (rather than OK) to create a duplicate guide with the movement already appliedMuch simpler!**
  
-**Part 2 Setting up the ESP8266+Supposons donc que vous disposez d'une ligne directrice horizontale et que vous souhaitez créer deux autres lignes directrices parallèles, espacées de 10 mm. Voici les étapes à suivre : 
 +••Double-cliquez sur la ligne existante pour faire apparaître la boîte de dialogue Ligne directrice. 
 +••Cliquez sur le bouton Dupliquer. La boîte de dialogue se ferme. 
 +••Double-cliquez sur la ligne nouvellement dupliquée (qui se trouve au-dessus de la ligne existante) pour ouvrir à nouveau la boîte de dialogue. 
 +••Entrez 10 mm dans le champ « Y », cochez la case « Changement relatif » et cliquez sur le bouton OK. La boîte de dialogue se ferme, mais vous avez maintenant deux guides sur la page, séparés de 10 mm. 
 +••Répétez les quatre étapes, mais en commençant par votre ligne nouvellement dupliquée et déplacée.
  
-You can download the software that goes on both the ESP8266 and the Pico from https://github.com/peterhinch/micropython-mqttGo ahead and download the zip file or clone the repository. If you download the zip fileunpack it somewhere convenientOnce it’s unpacked, you will want to go into the main folder and find the sub folder “bridge”. This is where the software for both the Pico (host folder) and the ESP8266 (esp8266 folder) will be found. The other thing that you need to do is to open the file BRIDGE.md. This file contains all the information that you should need to get things up and running.+Bien que la case « Changement relatif » reste cochée entre les étapes, la valeur du champ « Y » est effacéeCela rend frustrant la création d'une série de guides à espacement égalSi vous oubliez de cliquer sur le bouton « Dupliquer » avant de modifier la valeurvous finirez par déplacer votre guide original par erreurIl est impossible d'annuler cette erreur en appuyant sur Ctrl-Z : vous devrez rouvrir la boîte de dialogue et déplacer le guide de la valeur opposée pour le ramener à son point de départ.
  
-You know methoughI’ll distill it down as much as I can to get you running as quickly as possible, but you really should read through the md fileIf you don’t yet have a .md file readerI suggest Typora which you can find at typora.io. I’ve tried countless .md readers and editors and this is by far the best one that I’ve found.**+Heureusementcette fonctionnalité a été améliorée dans la version candidate 1.1Dans cette versionil vous suffit d'ouvrir la boîte de dialogue, d'introduire votre changement relatif, puis d'appuyer sur Dupliquer (plutôt que sur OK) pour créer un guide dupliqué avec le mouvement déjà appliquéC'est beaucoup plus simple !
  
-**The first thing that you need to do is flash the bridge software onto the ESP8266. To do this you need to use a tool called esptool. There are various ways to install esptool, but the easiest way for Python programmers is to use pip (or pip3). 
  
-pip install esptool+**Filter Region size
  
-or+From a frustrating change to a delightful one. In order to reduce the amount of processing required when a filter is applied to an object, SVG includes the ability to set a finite boundary outside of which the filter is no longer calculated. For some filters – particularly those involving large blurs or offsets – the default filter region is too small, resulting in the edges of the filtered content being cut-off with a hard boundary. You can see the effect quite clearly at the sides of this heavily blurred circle.
  
-pip3 install esptool+It’s always been possible to adjust the size of the filter region, via the Filter General Settings tab of the Filter Editor dialog. But the four fields you’ll find there are less than obvious to anyone who hasn’t read up on the inner details of SVG filters. You’ll also have to guess – or find out through trial-and-error – what the best values need to be for your particular image. Set the filter area too large and you’ll slow down the rendering of your image. Set it too small, or in the wrong position, and you’ll see your filter being cut-off.
  
-Once you have esptool installed, you will need to connect your ESP8266 board to your computer’s USB portJust for safety’s sakemake sure that there are no other development boards (like the Pico) connected to your computer AND make sure that Thonny is closed(If not, the flash might not work.Once its powered up, you need to find out what port your linux machine sees the board connected toIn a terminal, type:+With version 1.0guessing the optimum values for these fields is a thing of the pastWith a filtered object selectedswitch to the Node tool (F2and youll see diamond-shaped handles at the top-left and bottom-right of your object which can be dragged to directly adjust the filter region on the canvas.**
  
-ls /dev/tty* +Taille de la région de filtrage 
-**+ 
 +D'un changement frustrant à un changement très agréable. Afin de réduire la quantité du traitement nécessaire lorsqu'un filtre est appliqué à un objet, SVG inclut la possibilité de définir une limite finie en dehors de laquelle le filtre n'est plus calculé. Pour certains filtres - en particulier ceux qui impliquent des flous ou des décalages importants - la région de filtrage par défaut est trop petite, ce qui fait que les bords du contenu filtré sont coupés par une frontière stricte. Vous pouvez voir cet effet très clairement sur les côtés de ce cercle fortement flouté.
  
-**On my machineI get list that is 17 rows long and 6 columns wideBuried around the middle is the actual port that I’m connected to – which, for me, is dev/ttyACM0It’s important to know this port namesince you need to use it when you enter the CLI command linesThere are two steps, the first is to erase the existing flash memory contentsand the second is to load the modified firmware.+Il a toujours été possible d'ajuster la taille de la région du filtrevia l'onglet Paramètres généraux des filtres de la boîte de dialogue Éditeur de filtre. Mais les quatre champs que vous y trouverez sont moins qu'évidents pour quiconque n'pas lu les détails internes des filtres SVGVous devrez également deviner - ou découvrir par essais successifs - les meilleures valeurs pour votre image particulièreSi vous définissez une zone de filtrage trop largevous ralentirez le rendu de votre imageSi vous la réglez trop petite ou dans la mauvaise positionvotre filtre sera coupé.
  
-Nowusing the same terminal that we just used to find the serial portenter in the following commandreplacing the port with that of your machine+Avec la version 1.0deviner les valeurs optimales de ces champs fait partie du passé. Lorsqu'un objet filtré est sélectionnépassez à l'outil Node (F2) et vous verrez apparaître des poignées en forme de diamant en haut à gauche et en bas à droite de votre objetque vous pouvez faire glisser pour ajuster directement la région du filtre sur le canevas.
  
-esptool.py --port /dev/ttyACM0 --baud 115200 erase_flash 
  
-This usually takes about a minute or so to complete. You should see something like this...+**Importing SVG files
  
-esptool.py v3.0 +Inkscape v1.0 brings some more options when importing one SVG file into another, whether via File > Import, or by just dragging and dropping an SVG file from your file manager onto the Inkscape canvasBy default, dialog will be presented offering three different ways to import the image, plus a couple of settings that have an effect on only two of the three choices.
-Serial port /dev/ttyUSB0 +
-Connecting.... +
-Detecting chip type... ESP8266 +
-Chip is ESP8266EX +
-Features: WiFi +
-Crystal is 26MHz +
-MAC: 8c:aa:b5:59:40:93 +
-Uploading stub... +
-Running stub... +
-Stub running... +
-Erasing flash (this may take while)... +
-Chip erase completed successfully in 16.1s +
-Hard resetting via RTS pin...**+
  
-**Once the memory is erased, we need to load the new firmwareIn the terminal, make sure that you are in the bridge folder and enter the following command (again replacing the port definition with that of your own)…+The first option will probably be the one most people useIt’s the same way that previous versions of Inkscape imported SVG images: by adding all the objects from the imported image as first-class, editable objects inside the existing document. Images imported in this way are essentially indistinguishable from any other elements drawn within the Inkscape document.
  
-esptool.py --port /dev/ttyACM0 --baud 115200 write_flash --verify --flash_size=detect -fm qio 0 firmware-combined.bin+The second option embeds the SVG content as a base64 encoded string in an <img> tagIf those words are gobbledegook to you, then you’re probably not a web developer. In layman’s terms, it just means that the SVG content is stored within the file, but as a single image that can be treated much like a bitmap version of the vector image. Indeed, Inkscape actually renders it as a bitmap version, so zooming in, or scaling the image too large, can make it look blocky. More on that shortly.
  
-The terminal output should look something like this+The third option links to the SVG file. Unlike the prior options, this means that the linked file can be updated outside of Inkscape, and the changes will be reflected in your Inkscape document. But it also means that moving the Inkscape file to another machine will also require the linked image to be sent, and the link potentially updated to reflect the new location of the file on disk. Inkscape also displays linked images as bitmap versions, so the same zoom and scale warning applies as previously.**
  
-esptool.py v3.0 +Importation de fichiers SVG
-Serial port /dev/ttyUSB0 +
-Connecting.... +
-Detecting chip type... ESP8266 +
-Chip is ESP8266EX +
-Features: WiFi +
-Crystal is 26MHz +
-MAC: 8c:aa:b5:59:40:93 +
-Uploading stub... +
-Running stub... +
-Stub running... +
-Configuring flash size... +
-Auto-detected Flash size: 4MB +
-Flash params set to 0x0040 +
-Compressed 622784 bytes to 409382... +
-Wrote 622784 bytes (409382 compressed) at 0x00000000 in 36.1 seconds (effective 137.8 kbit/s)... +
-Hash of data verified.**+
  
-**Leaving... +Inkscape v1.0 apporte quelques options supplémentaires lors de l'importation d'un fichier SVG dans un autreque ce soit via Fichier > Importer, ou simplement en glissant et déposant un fichier SVG depuis votre gestionnaire de fichiers sur le canevas d'InkscapePar défaut, une boîte de dialogue sera présentée offrant trois façons différentes d'importer l'image, plus quelques paramètres qui n'ont d'effet que sur deux des trois choix.
-Verifying just-written flash... +
-(This option is deprecatedflash contents are now always read back after flashing.) +
-Flash params set to 0x0040 +
-Verifying 0x980c0 (622784) bytes @ 0x00000000 in flash against firmware-combined.bin... +
--- verify OK (digest matched) +
-Hard resetting via RTS pin...+
  
-During the flash process, there should be an LED flashing on the ESP8266 board as blocks of the firmware are being writtenWhen the process is finished, the LED should stop flashingIf it continues to flash, something happened and you need to start again by erasing the firmware and re-installing it.+La première option est probablement celle que la plupart des gens utilisentC'est de la même manière que les versions précédentes d'Inkscape importaient des images SVG : en ajoutant tous les objets de l'image importée en tant qu'objets éditables de première classe dans le document existantLes images importées de cette manière sont essentiellement indiscernables de tout autre élément dessiné dans le document Inkscape.
  
-Now we can move on to making the connections to our Pico.**+La deuxième option consiste à incorporer le contenu SVG sous la forme d'une chaîne codée en base64 dans une balise <img>. Si ces mots sont du charabia pour vous, alors vous n'êtes probablement pas un développeur Web. En termes simples, cela signifie que le contenu SVG est stocké dans le fichier, mais sous la forme d'une image unique qui peut être traitée comme une version bitmap de l'image vectorielle. En fait, Inkscape rend l'image comme une version bitmap, ce qui fait qu'un zoom ou une mise à l'échelle trop importante de l'image peut lui donner l'apparence d'un bloc. Nous y reviendrons bientôt.
  
-**Part 3 - Connecting the Pico to the ESP8266+La troisième option établit un lien avec le fichier SVG. Contrairement aux options précédentes, cela signifie que le fichier lié peut être mis à jour en dehors d'Inkscape et que les changements seront reflétés dans votre document Inkscape. Mais cela signifie également que, si vous déplacez le fichier Inkscape vers une autre machine, l'image liée devra également être envoyée et le lien potentiellement mis à jour pour refléter le nouvel emplacement du fichier sur le disque. Inkscape affiche également les images liées comme des versions bitmap, de sorte que le même avertissement de zoom et d'échelle s'applique comme précédemment.
  
-For whatever device you are going to use as the ESP8266 board, you should make sure you download the latest pinout for that board, since the various manufacturers can change the pinouts. In my case, the pinout for the NodeMCU ESP8266 board was found at https://components101.com/development-boards/nodemcu-esp8266-pinout-features-and-datasheet . 
  
-Now be sure to orient the board and the pinout and begin to place your jumpers. Luckilythe data pins on my NodeMCU board are all marked and they match up with the pins for the Mini in the table belowI verified the wires that I connected to the NodeMCU board at least three times then I made the connections to the breadboard that I had the Pico mounted on and verified them again. What can I say? I HATE to blow up boards. Of course, I did this with the boards all unpluggedI’ve copied the table here (left) just to make it easy for you.**+**Although Inkscape displays linked and embedded SVG images as bitmaps, it’s important to understand that the linked file, and the base64 encoded embedded content, are both still SVG documents in all their vector gloryFor example, even the blockiest looking embedded SVG will look crisp and clean when the containing file is loaded into a web browser.
  
-**Host and target must share common groundThey need not share a common power+When linking or embedding an SVG file, you do have some limited control over the bitmap that Inkscape displays as proxy. The “DPI for rendered SVG” field in the import dialog lets you set the quality of the rasterized content. Higher DPI values will capture finer details from the vector content, which may allow you to scale or zoom with less obvious loss of detail. The “Image Rendering Mode” pop-up lets you select the trade-off Inkscape uses between quality and speed when rasterizing. Most of the time leaving this as “None (auto)” will be good enough.
  
-source - the order in which they are powered up is not criticalThe 5V link enables USB connection on the host to power the ESP8266.+Because the bitmap representation is just an artefact of the way that Inkscape works, and doesn’t affect the underlying vector content, it’s even possible to change the DPI and render trade-off after the image has been imported or linked. Right-click on the image and select Object Properties, or use Object > Object Properties. In the dialog that opens, you can modify the DPI setting or change the rendering mode – with even more options available than in the original import dialogThis means that any blockiness that appears as result of scaling an imported SVG image can be addressed after-the-fact, so there’s no need to worry too much about which values you use when importing.
  
-We will be providing the power for the ESP8266 directly from the Pico. You can see from the wiring diagram on the next page, the 5 volts to power the ESP8266 comes from physical pin 40 – which is VBUSVBUS provides +5Vdc directly from the Picos USB connection with your computer. This is important to remember if you ever want to make this a standalone project. You will have to provide the +5Vdc for the ESP8266 from another source.+The defaults for the import dialog are set in the Imported Images pane of the Edit > Preferences dialog (where you’ll also find the defaults for importing bitmap images)Should you check the “Dont ask again” box in the dialog, then this is also where you need to come to re-enable it once you discover that the defaults don’t always suit your needs.**
  
-So now the hard part is done.**+Bien qu'Inkscape affiche les images SVG liées et intégrées comme des bitmaps, il est important de comprendre que le fichier lié, et le contenu intégré encodé en base64, sont tous deux des documents SVG dans toute leur gloire vectorielle. Par exemple, même le SVG intégré ressemblant le plus à un bloc aura l'air net et propre lorsque le fichier qui le contient est chargé dans un navigateur Web.
  
-**Part 4 - The Pico side of things+Lorsque vous liez ou intégrez un fichier SVG, vous avez un contrôle limité sur le bitmap qu'Inkscape affiche en tant que proxy. Le champ « DPI pour le rendu SVG » dans le dialogue d'importation vous permet de définir la qualité du contenu rastérisé. Des valeurs DPI plus élevées captureront des détails plus fins du contenu vectoriel, ce qui peut vous permettre de mettre à l'échelle ou de zoomer avec une perte de détails moins évidente. La fenêtre contextuelle « Mode de rendu d'image » vous permet de sélectionner le compromis qu'Inkscape utilise entre la qualité et la vitesse lors du tramage. La plupart du temps, le choix de « Aucun (défaut) » est suffisant.
  
-Nowwe can start to work on the Pico part of the projectThere will be two files that we need to load and modify. The first file is net_local.py that is located in the bridge/host folder. You can think of this as your secrets file where you store your network router addressnetwork password, and the location of your brokerHere’what it looks like (without the comments)See code top right.+Étant donné que la représentation bitmap n'est qu'un artefact de la façon dont Inkscape fonctionneet qu'elle n'affecte pas le contenu vectoriel sous-jacent, il est même possible de modifier le DPI et le compromis de rendu après que l'image a été importée ou liéeFaites un clic droit sur l'image et sélectionnez Propriétés de l'objetou utilisez Objet > Propriétés de l'objetDans la boîte de dialogue qui s'ouvre, vous pouvez modifier le paramètre DPI ou changer le mode de rendu - avec encore plus d'options disponibles que dans la boîte de dialogue d'importation originaleCela signifie que tout effet de bloc qui apparaît à la suite de la mise à l'échelle d'une image SVG importée peut être corrigé après coup, de sorte qu'il n'est pas nécessaire de se préoccuper des valeurs que vous utilisez lors de l'importation.
  
-Set the ssid field to your network nameChange the password to the one you use to connect your computer to the network. Finallyfor this test, set the broker field to “test.mosquitto.org”. Save the file. It should look something like the code shown middle right.**+Les valeurs par défaut de la boîte de dialogue d'importation sont définies dans le volet Importation d'images de la boîte de dialogue Édition > Préférences (où vous trouverez également les valeurs par défaut pour l'importation d'images bitmap)Si vous avez coché la case « Ne plus demander » dans la boîte de dialoguec'est également là que vous devez venir pour la réactiver si vous découvrez que les valeurs par défaut ne répondent pas toujours à vos besoins.
  
-**Now you need to load the file pico_simple.py from the bridge/host/generic folder. We won’t be changing too much, but we will make a couple of changes. I’ll present the entire file (minus the comments) and will put only the lines that need to be changed or added in bold. 
  
-First the import section. There is only one additional import needed here…+**Mesh Gradient polyfill
  
-import uasyncio as asyncio+If you save an SVG image containing a Mesh Gradient (see part 59 of this series), Inkscape will now embed a JavaScript polyfill in the file. As I’ve remonstrated previously, browsers still don’t support mesh gradients in their SVG implementations. This polyfill goes some way towards addressing that shortcoming.
  
-from pbmqtt import MQTTlink+When the SVG file is loaded directly into the browser, or is included within a web page in a way that allows JavaScript to run (i.e. via an <object> tag, or by inlining the SVG content), the polyfill code will execute, rendering a bitmap version of the mesh gradient in order to approximate the original appearance of the file.
  
-import hw_pico as hardware  # Pin definitionsHeartbeat on Pico LED.+The idea is to break the impasse that is preventing mesh gradients gaining browser supportThe browser vendors won’t put time into their implementation due to a lack of files on the internet that use the feature. But few people put such files online because the browsers don’t support them.
  
-import net_local            # WiFi credentials+If you’re technically competent enough to be able to put SVG images online in an <object> tag, then I urge you to create something with mesh gradients and share it with the world. Only by increasing the number of such files out there can we ever hope to get native support in web browsers.**
  
-from utime import localtime, gmtime, time+Polyfill de filet de dégradé
  
 +Si vous enregistrez une image SVG contenant un dégradé de maillage (voir la partie 59 de cette série), Inkscape va maintenant intégrer un polyfill JavaScript dans le fichier. Comme je l'ai démontré précédemment, les navigateurs ne supportent toujours pas les filets de dégradé dans leurs implémentations SVG. Ce polyfill permet de combler dans une large mesure cette lacune.
  
-The next line doesn’t get changed.+Lorsque le fichier SVG est chargé directement dans le navigateur, ou est inclus dans une page Web d'une manière qui permet à JavaScript de s'exécuter (c'est-à-dire via une balise <object>, ou par inlining du contenu SVG), le code polyfill s'exécutera, rendant une version bitmap du filet de dégradé afin d'approcher l'apparence originale du fichier.
  
-qos = 1  # for test all messages have the same qos.**+L'idée est de sortir de l'impasse qui empêche les filets de dégradé d'être pris en charge par les navigateurs. Les fournisseurs de navigateurs ne veulent pas consacrer de temps à leur mise en œuvre en raison du manque de fichiers sur Internet qui utilisent cette fonctionnalité. Mais peu de gens mettent ces fichiers en ligne parce que les navigateurs ne les prennent pas en charge.
  
-**Nextwe will add a function to read the Pico internal temperature sensor (next page, bottom left)It’s almost the same as the test program we did in part 1 above. The only differences are that we are adding a call to printline, I’ve commented the 2 second sleep statement since we don’t need that and then the return temperaturef to the calling function. If you want to send out temperatures in Celsius, then return the variable temperature.+Si vous êtes suffisamment compétent sur le plan technique pour pouvoir mettre en ligne des images SVG dans une balise <object>je vous invite à créer quelque chose avec des filets de dégradé et à la partager avec le monde entierCe n'est qu'en augmentant le nombre de ces fichiers que nous pourrons espérer obtenir un jour un support natif dans les navigateurs Web.
  
-The publish function is where we actually send data out to the MQTT server. There are only two lines that need to be added. The first line prints the fact that we are sending something out and the second line actually publishes the internal temperature. Notice that this line is all one line (right).** 
  
-**There is one point that I want to make here. The line above – await asyncio.sleep(10) – sets the delay between the publish messages. If you want to speed it up, then set the sleep value to less than 10. If you want a longer delay between the publish messages, make it a bigger value.+**PNG export
  
-MQTTlink.will('result''simple client died')+The PNG export dialog has gained an Advanced section which allows you to set a number of parameters for the exported fileMost users will probably never need themso I won’t go into detail about them here, other than to point out that the “pHYs dpi” field is almost certainly what you’re looking for before opening a thread on the forum about how Inkscape PNG files don’t appear at the “correct” size in some other program. Unless you have a specific need to modify these fields, you can probably leave them as-is. They’re hidden in an Advanced section for a reason.**
  
-mqtt_link = MQTTlink(hardware.d, net_local.d, wifi_handler=(cbnet,()), verbose=True) #, debug=True+Exportation en PNG
  
-try:+La boîte de dialogue d'exportation en PNG a gagné une section Options avancées qui vous permet de définir un certain nombre de paramètres pour le fichier exporté. La plupart des utilisateurs n'en auront probablement jamais besoin, aussi je n'entrerai pas dans les détails ici, si ce n'est pour signaler que le champ « pHYs ppp » est presque certainement ce que vous rechercherez avant d'ouvrir un fil sur le forum sur le fait que les fichiers PNG d'Inkscape n'apparaissent pas à la « bonne » taille dans un autre programme. À moins que vous n'ayez un besoin spécifique de modifier ces champs, vous pouvez probablement les laisser tels quels. Ce n'est pas pour rien qu'ils sont cachés dans une section Options avancées.
  
- asyncio.run(main(mqtt_link)) 
  
-finally:+**3-digit RGB values
  
- asyncio.new_event_loop()**+RGB colors are often denoted as 6-digit hexadecimal valuesBut a common shortcut in CSS is to provide just three hex digits, each of which is doubled to produce the final 6-digit (hexversion. So, a value of #1ca would be expanded to #11ccaa. Inkscape now supports entering three digits into the Fill & Stroke dialog to set colors, though the value that is actually stored in the SVG file will still be the full 6-digit version.
  
-**When you run the program, you should see the onboard LED flash about every secondand in the shell window you should see…+The alpha (opacity) will be set to 100% (a value of 255or #ff in hex), but if you enter a 4-digit hex valuethis will be expanded in a similar way to produce both the 6-digit color and a 2-digit alpha value. So, #1cab would be expanded to #11ccaa and #bb.**
  
->>> %Run -c $EDITOR_CONTENT +Valeurs RVB à chiffres
-initiator  resetting target... +
-initiator  awaiting sync... +
-initiator  synchronised. +
-Starting... +
-13:52:01 Status:  Will registered +
-13:52:01 Status:  awaiting default network +
-13:52:06 Status:  awaiting broker +
-13:52:07 Status:  connected to broker +
-13:52:07 Status:  running +
-About to run user program. +
-cbnet: network is up +
-13:52:07 Status:  WiFi up +
-13:52:07 Status:  publish OK +
-Sending 2 +
-13:52:07 80.67992 +
-Sending 3 +
-13:52:18 78.9946**+
  
-**If you want to verify the fact that you are actually sending the messages out to the Brokeropen a terminal on your computer (assuming you’ve installed the mosquitto packagesand type:+Les couleurs RVB sont souvent désignées par des valeurs hexadécimales à 6 caractères. Mais un raccourci courant en CSS consiste à fournir seulement trois caractères hexadécimauxchacun d'entre eux étant doublé pour produire la version finale à 6 caractères (hex). Ainsi, une valeur de #1ca sera développée en #11ccaa. Inkscape permet désormais de saisir trois caractères dans la boîte de dialogue Remplissage & Contour pour définir les couleurs, bien que la valeur effectivement stockée dans le fichier SVG soit toujours la version complète à 6 caractères.
  
-mosquitto_sub -h test.mosquitto.org -t InternalTemperature+L'alpha (opacité) sera fixé à 100 % (une valeur de 255, ou #ff en hexadécimal), mais si vous entrez une valeur hexadécimale à 4 chiffres, celle-ci sera étendue de manière similaire pour produire à la fois la couleur à 6 chiffres et une valeur alpha à 2 chiffresAinsi, #1cab sera étendu à #11ccaa et #bb.
  
-Nothing will happen until you actually start sending, but when you are, here’s what it will look like. 
  
-greg@earth:~$ mosquitto_sub -h 192.168.1.67 -t InternalTemperature +**Save as a template
-79.83727 +
-78.15195 +
-78.9946 +
-78.9946 +
-78.9946+
  
-One word of warning. Ive noticed that every time I have to stop the program to make a change or just to restart it, I have to unplug the Picowait few seconds, then plug it back inIm not quite sure why.**+Its long been possible to add to Inkscape’s set of templates by creating your own SVG file and putting it in the right place on disk. With version 1.0the process has been made whole lot simpler with the addition of a “Save Template…” entry in the File menu. Simply create the template you need, setting the page size and units, adding guides, and including some boilerplate SVG content if you wish, then choose the menu entry and enter a few basic detailsYour template will appear in the “New from Template” dialog immediately – you dont even need to restart the program.
  
-**Id suggest that you consider setting up a MQTT server on another machinelike a Raspberry PiIt’s simple to do. I previously wrote a three-part article in Full Circle issues 132133 and 134 which will get you going if you need it.+Its not all perfecthoweverAlthough the creation dialog has a field for Keywords, there’s no indication as to how these should be delimitedFrom looking at the internals of existing templates, believe that you need to use spaces between the words. Even doing this won’t make them searchable in the “New from Template” dialog, though. It appears that there’s a bit of a mismatch between the template files that Inkscape creates using this feature, and the code that displays them in the dialog.
  
-BONUS Part 6 Monitoring your MQTT Communications+Existing templates store the metadata you provide in some XML elements whose names are prefixed with an underscore. Using the “Save Template…” feature stores them in un-prefixed elements. It’s possible to modify the XML content in a text editor, adding the underscores to make the template keywords searchable, but that really shouldn’t be necessary. I’ll be filing a bug report about this one. 
 +Even with this glitch, the ability to more easily create templates is a very welcome addition.**
  
-Yes, I’m providing a bonus part this month. I’m going to explain how to get and use a fantastic program called MQTT Explorer to monitor the communications between your Pico and the MQTT Server, wherever it is located.+Enregistrer comme modèle
  
-You can find it at http://mqtt-explorer.com/ and download it as an AppImage from: https://github.com/thomasnordquist/MQTT-Explorer/releases/download/0.0.0-0.4.0-beta1/MQTT-Explorer-0.4.0-beta1.AppImage **+Il est depuis longtemps possible de compléter l'ensemble des modèles d'Inkscape en créant son propre fichier SVG et en le plaçant au bon endroit sur le disqueAvec la version 1.0, le processus a été rendu beaucoup plus simple avec l'ajout d'une entrée « Enregistrer un modèle... » dans le menu FichierCréez simplement le modèle dont vous avez besoin, en définissant la taille de la page et les unités, en ajoutant des guides et en incluant un contenu SVG standard si vous le souhaitez, puis choisissez l'entrée du menu et entrez quelques détails de baseVotre modèle apparaîtra immédiatement dans la boîte de dialogue « Nouveau à partir d'un modèle » vous n'avez même pas besoin de redémarrer le programme.
  
-**It’s really easy to get set up and start monitoring your communications to the MQTT serverSince all we are sending is temperature valuesyou can also see the data as graph.+Tout n'est pas parfait, cependantBien que la boîte de dialogue de création comporte un champ pour les mots-clésil n'aucune indication sur la manière dont ceux-ci doivent être délimités. En examinant les éléments internes des modèles existants, je pense que vous devez utiliser des espaces entre les mots. Même en faisant cela, vous ne pourrez pas les rechercher dans la boîte de dialogue « Nouveau à partir d'un modèle ». Il semble qu'il y ait un léger décalage entre les fichiers de modèle qu'Inkscape crée en utilisant cette fonctionnalité, et le code qui les affiche dans la boîte de dialogue.
  
-You can find the code we’ve written and modified at my github repository at https://github.com/gregwa1953/FCM169_MicroThisMicroThat**+Les modèles existants stockent les métadonnées que vous fournissez dans certains éléments XML dont les noms sont préfixés par un trait de soulignement. L'utilisation de la fonction « Enregistrer un modèle... » les stocke dans des éléments non préfixés. Il est possible de modifier le contenu XML dans un éditeur de texte, en ajoutant les traits de soulignement pour rendre les mots-clés du modèle interrogeables, mais cela ne devrait pas être nécessaire. Je vais déposer un rapport de bogue à ce sujet.
  
-**Final Thoughts+Même avec ce problème, la possibilité de créer plus facilement des modèles est un ajout très appréciable.
  
-Just so you know, I’m going to put the RPi Pico “on pause” so to speak, and look at another popular microcontroller, the ESP-32. This will be in the form of the SparkFun Thing Plus ESP-32 WROOM (https://www.sparkfun.com/products/15663) which you can pick up for around $21.00 USD. You can find other clone type boards for around $11.00 USD if your budget just won’t go the extra cost. We’ll be using a SSD1306 OLED display as well as the BMP180 and an Adafruit SI7021 Temperature/Humidity module (https://www.adafruit.com/product/3251 – about $9.00 USD) to show the different ways of programming the two modules. While you are thinking about things, you might consider getting a few Stemma QT/Qwiic cables. There are two types I would suggest: 
-•  The first has the molex on both ends, which makes quick work of connecting I2C devices to the Thing Plus (https://www.adafruit.com/product/4210) and other types of microcontrollers. 
-•  The other has the molex plug on one end and regular male pins for use on a breadboard (https://www.adafruit.com/product/4209).** 
  
-**We’ll be coming back to the RPi Pico in a couple of months, since I’ve got LOTS of goodies that can be done with the Pico.+**Removed features
  
-AlsoI’m working on a list of “important must have” sensors and displays along with sourcing and packagingI’ll try to get that started for you in next month’s article as well.+A few features have been removed from version 1.0 for various reasons. These are the main ones that you might notice: 
 +File > Import Clip Art: This feature used to allow direct downloading of files from the OpenClipart.org websitehowever the API that Inkscape used is no longer operational. The website does indicate that V2 of the API is in beta, so perhaps this feature will return in the future. 
 +Save As Cairo PNG: This option has been removed from the Save As dialog as it had limited functionality, and was often confused with the File > Export PNG Image option, which is much more capable. 
 +UniConvertor: Inkscape is no longer built with the UniConvertor library. This means that a number of third party file formats can no longer be opened or saved from Inkscape directly. If you do need to work with any of these file types a possible workaround would be to install the UniConvertor command-line tool and convert the files to the SVG format prior to loading them into Inkscape, or back the other way after saving. 
 +Selection Sets: Despite being added in only version 0.91, the Selection Sets dialog has been removed. I described this feature in part 62 of this series, and I would rather have seen it polished and improved than dropped entirely. Performing some types of complex selections in Inkscape can still be tricky, and selection sets offer a way to combine several simpler selections to achieve the same result. Nevertheless, I doubt this dialog will be much missed by most users.
  
-WellIve taken up way too many pages of the magazine this monthso I'm going to wish you luck and happy times.+When even the list of small changes fills a whole articleits clear that Inkscape development is continuing at a pace. The imminent release of version 1.1 will no doubt add to my list of topics to coverbut next month I’ll be continuing to describe some of the more significant changes in 1.0.x.**
  
-Until next time, as always; stay safe, healthy, positive and creative!**+Fonctions supprimées
  
 +Quelques fonctionnalités ont été supprimées de la version 1.0 pour diverses raisons. Voici les principales que vous pourriez remarquer :
 +Fichier > Importer Clip Art : Cette fonctionnalité permettait de télécharger directement des fichiers depuis le site OpenClipart.org, mais l'API utilisée par Inkscape n'est plus opérationnelle. Le site Web indique que la V2 de l'API est en version bêta, ce qui signifie qu'il se peut que cette fonctionnalité revienne dans le futur.
 +Enregistrer sous Cairo PNG : Cette option a été supprimée de la boîte de dialogue Enregistrer sous car elle avait une fonctionnalité limitée et était souvent confondue avec l'option Fichier > Exporter une image PNG, qui est beaucoup plus performante.
 +UniConvertor : Inkscape n'est plus construit avec la bibliothèque UniConvertor. Cela signifie qu'un certain nombre de formats de fichiers tiers ne peuvent plus être ouverts ou enregistrés directement depuis Inkscape. Si vous avez besoin de travailler avec l'un de ces types de fichiers, vous pouvez installer l'outil de ligne de commande UniConvertor et convertir les fichiers au format SVG avant de les charger dans Inkscape, ou inversement après les avoir enregistrés.
 +Jeux de sélection : Bien qu'il n'ait été ajouté que dans la version 0.91, le dialogue des jeux de sélection a été supprimé. J'ai décrit cette fonctionnalité dans la partie 62 de cette série, et j'aurais préféré la voir polie et améliorée plutôt qu'abandonnée complètement. Effectuer certains types de sélections complexes dans Inkscape peut encore être délicat, et les ensembles de sélection offrent un moyen de combiner plusieurs sélections plus simples pour obtenir le même résultat. Néanmoins, je doute que ce dialogue manque beaucoup à la plupart des utilisateurs.
  
 +Lorsque même la liste des petits changements remplit un article entier, il est clair que le développement d'Inkscape se poursuit à un rythme soutenu. La sortie imminente de la version 1.1 viendra sans doute s'ajouter à ma liste de sujets à couvrir, mais le mois prochain je continuerai à décrire certains des changements les plus significatifs de la 1.0.x.
  
issue169/inkscape.1622894795.txt.gz · Dernière modification : 2021/06/05 14:06 de d52fr