fritzing / fritzing-parts

Electronic components for use in the Fritzing app (aka the parts library)
http://fritzing.org/parts
Other
506 stars 360 forks source link

core parts need cleaning #318

Open davidperrenoud opened 10 years ago

davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 09, 2009 15:00:26

There are lots of core parts in need of cleaning.

  1. Many still have sodipodi stuff; sometimes this has been cleaned up, but there are still a dangling attributes left
  2. Every element in a part that will be visible should be inside a <g id="[layer-id]"> element (call this the g-layer-id element). In other words, this element should be either at the top level of the svg, or if there are several layers, next level down. Some parts don't have a g- layer-id-element. Some parts don't have all visible subelements inside the g-layer-id element.
  3. Before a part gets added to the core, one of us needs to check it out.
    Dropping a candidate part into a sketch and exporting it as an svg seems to be a good way to surface problems with a part.
  4. I think we should add new parts to some svn holding pen before they're actually moved into core and released.

Original issue: http://code.google.com/p/fritzing/issues/detail?id=812

davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 09, 2009 12:08:13

  1. Found some parts with no viewBox attribute, and/or the height and width attributes have no units
davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 15, 2009 02:47:56

As far as I can tell, Qt gets confused when the width and height attributes of the svg element are "px" (as opposed to "in"). So we also need to edit these parts.

davidperrenoud commented 10 years ago

From brendan....@gmail.com on November 09, 2009 05:18:16

we need a list and then we can clean em up.

davidperrenoud commented 10 years ago

From irasc...@gmail.com on November 11, 2009 04:57:43

found "sodipodi":

parts\svg\core\breadboard\atmega168.svg:435 parts\svg\core\breadboard\basic_photo_transistor.svg:399 parts\svg\core\breadboard\basic_relay.svg:399 parts\svg\core\breadboard\ceramic_disk_thermistor.svg:300 parts\svg\core\breadboard\peltier_element.svg:243 parts\svg\core\breadboard\StepperMotor-_Bipolarbreadboard.svg:404 parts\svg\core\breadboard\StepperMotor-_Unipolar__breadboard.svg:404 parts\svg\core\icon\loudspeaker.svg:407 parts\svg\core\icon\microphone.svg:407 parts\svg\core\icon\solenoid.svg:407 parts\svg\core\icon\StepperMotor-_Bipolaricon.svg:404 parts\svg\core\icon\StepperMotor-_Unipolaricon.svg:404 parts\svg\core\icon\usb_connector.svg:402 parts\svg\core\pcb\pcb-arduino-diecimila.svg:300 parts\svg\core\schematic\atmega168_schematic.svg:411 parts\svg\core\schematic\basic_transistor_npn.svg:300 parts\svg\core\schematic\basic_transistor_pnp.svg:300 parts\svg\core\schematic\capacitor_polar.svg:300 parts\svg\core\schematic\diode.svg:300 parts\svg\core\schematic\lm358_schematic.svg:358 parts\svg\core\schematic\peltier_element.svg:360 parts\svg\core\schematic\power_plug.svg:175 parts\svg\core\schematic\relay.svg:375 parts\svg\core\schematic\spdt-switch.svg:300 parts\svg\core\schematic\StepperMotor-_Bipolar__schematic.svg:300 parts\svg\core\schematic\StepperMotor-_Unipolarschematic.svg:300 parts\svg\core\schematic\thermistor.svg:399 parts\svg\core\schematic\voltage_regulator_5v.svg:300 parts\svg\core\schematic\voltage_regulator_7833.svg:300 parts\svg\core\schematic\voltage_regulator_LM317.svg:300 parts\svg\obsolete\pcb\peltier_sensor.svg:300 parts\svg\obsolete\pcb\StepperMotor-_Bipolar__pcb.svg:404 parts\svg\obsolete\pcb\StepperMotor-_Unipolar__pcb.svg:404 parts\svg\obsolete\pcb\to92.svg:300

davidperrenoud commented 10 years ago

From irasc...@gmail.com on November 11, 2009 04:58:08

found "inkscape"

parts\svg\core\breadboard\atmega168.svg:506 parts\svg\core\breadboard\basic_photo_transistor.svg:470 parts\svg\core\breadboard\basic_relay.svg:470 parts\svg\core\breadboard\ceramic_disk_thermistor.svg:371 parts\svg\core\breadboard\lm358_bread.svg:94 parts\svg\core\breadboard\peltier_element.svg:331 parts\svg\core\breadboard\StepperMotor-_Bipolarbreadboard.svg:94 parts\svg\core\breadboard\StepperMotor-_Unipolar__breadboard.svg:94 parts\svg\core\icon\loudspeaker.svg:300 parts\svg\core\icon\microphone.svg:300 parts\svg\core\icon\mystery_part_icon.svg:2640 parts\svg\core\icon\solenoid.svg:300 parts\svg\core\icon\StepperMotor-_Bipolaricon.svg:94 parts\svg\core\icon\StepperMotor-_Unipolaricon.svg:94 parts\svg\core\icon\usb_connector.svg:470 parts\svg\core\pcb\pcb-arduino-diecimila.svg:371 parts\svg\core\schematic\atmega168_schematic.svg:326 parts\svg\core\schematic\basic_transistor_npn.svg:371 parts\svg\core\schematic\basic_transistor_pnp.svg:371 parts\svg\core\schematic\capacitor_polar.svg:371 parts\svg\core\schematic\diode.svg:371 parts\svg\core\schematic\lm358_schematic.svg:94 parts\svg\core\schematic\peltier_element.svg:275 parts\svg\core\schematic\power_plug.svg:281 parts\svg\core\schematic\reed_switch.svg:94 parts\svg\core\schematic\relay.svg:290 parts\svg\core\schematic\spdt-switch.svg:371 parts\svg\core\schematic\StepperMotor-_Bipolarschematic.svg:371 parts\svg\core\schematic\StepperMotor-_Unipolarschematic.svg:371 parts\svg\core\schematic\thermistor.svg:470 parts\svg\core\schematic\voltage_regulator_5v.svg:371 parts\svg\core\schematic\voltage_regulator_7833.svg:371 parts\svg\core\schematic\voltage_regulator_LM317.svg:371 parts\svg\obsolete\pcb\peltier_sensor.svg:371 parts\svg\obsolete\pcb\StepperMotor-_Bipolarpcb.svg:94 parts\svg\obsolete\pcb\StepperMotor-_Unipolar__pcb.svg:94 parts\svg\obsolete\pcb\to92.svg:371

davidperrenoud commented 10 years ago

From irasc...@gmail.com on November 11, 2009 05:16:23

no "viewBox"

parts\svg\core\breadboard\basic_photo_transistor.svg:-1 parts\svg\core\breadboard\basic_resistor.svg:-1 parts\svg\core\icon\555timericon.svg:-1 parts\svg\core\icon\basic-diode.svg:-1 parts\svg\core\icon\basic_fsr.svg:-1 parts\svg\core\icon\basic_pbutton.svg:-1 parts\svg\core\icon\basic_photo_transistoricon.svg:-1 parts\svg\core\icon\basic_relay.svg:-1 parts\svg\core\icon\basic_resistor.svg:-1 parts\svg\core\icon\basic_servo.svg:-1 parts\svg\core\icon\basic_toggle_switch.svg:-1 parts\svg\core\icon\dc_motor.svg:-1 parts\svg\core\icon\lm358icon.svg:-1 parts\svg\core\icon\optocoupler4n35_icon.svg:-1 parts\svg\core\icon\plain_pcb.svg:-1 parts\svg\core\icon\potentiometer.svg:-1 parts\svg\core\icon\StepperMotor-_Bipolaricon.svg:-1 parts\svg\core\icon\StepperMotor-_Unipolar__icon.svg:-1 parts\svg\core\schematic\555timerschematic.svg:-1 parts\svg\core\schematic\basic_fsr.svg:-1 parts\svg\core\schematic\basic_transistor_npn.svg:-1 parts\svg\core\schematic\basic_transistor_pnp.svg:-1 parts\svg\core\schematic\capacitor.svg:-1 parts\svg\core\schematic\capacitor_polar.svg:-1 parts\svg\core\schematic\diode.svg:-1 parts\svg\core\schematic\fet_n.svg:-1 parts\svg\core\schematic\fet_p.svg:-1 parts\svg\core\schematic\ldr.svg:-1 parts\svg\core\schematic\led.svg:-1 parts\svg\core\schematic\lm358_schematic.svg:-1 parts\svg\core\schematic\optocoupler4n35_schematic.svg:-1 parts\svg\core\schematic\pushbutton4lead.svg:-1 parts\svg\core\schematic\reed_switch.svg:-1 parts\svg\core\schematic\resistor.svg:-1 parts\svg\core\schematic\servo_schematic.svg:-1 parts\svg\core\schematic\spdt-switch.svg:-1 parts\svg\core\schematic\StepperMotor-_Bipolarschematic.svg:-1 parts\svg\core\schematic\StepperMotor-_Unipolarschematic.svg:-1 parts\svg\obsolete\pcb\LED-red-5mmpcb.svg:-1 parts\svg\obsolete\pcb\peltier_sensor.svg:-1 parts\svg\obsolete\pcb\StepperMotor-_Bipolarpcb.svg:-1 parts\svg\obsolete\pcb\StepperMotor-_Unipolar__pcb.svg:-1

davidperrenoud commented 10 years ago

From irasc...@gmail.com on June 30, 2010 13:58:51

Owner: irascibl
Cc: -andre.knoerig -lionel.michel -irascibl -merunga

davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 27, 2010 13:55:11

Labels: Component-Parts

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 11, 2011 02:51:24

I'm trying to make a checklist so that I can write a parser that will automatically detect SVG problems. Please help me with any other issues you remember.

  1. illustrator non-standard px (or missing) units
  2. svgs missing the viewbox attribute
  3. simple linear and radial gradients are now ok, gradient refs (using xlink syntax back to "defs") are not
  4. xlinks don't work
  5. svg height and width values with no units
  6. svgs that say both "illustrator" and "inkscape" (or "sodipodi")
  7. connector references not contained within a recognized layer

this is ok: ... <circle id="connectorXpin" ...> ...

this is not ok: <circle ... id="connectorXpin" .../> ....

  1. text using elements (this is not allowed in tiny 1.2). Fritzing code does check for this condition, but a few cases may still be slipping through the cracks.
  2. internal coordinates with units (all coordinates are supposed to be relative to the viewBox, so units are not necessary)
  3. All the crap that comes with inkscape. Inkscape images should be saved as "plain svg". The only known bug here I can barely remember, but it had to do with inkscape caching extra versions of some coordinates for certain svg elements, and Fritzing finding the wrong set.
  4. We have gotten a lot better about dealing with transforms, but still, the fewer the better. We are also better at dealing with internal transforms (where the transform is an attribute inside a , , , ... element) but problems are still sometimes turning up, so try to avoid this formulation.
  5. Transforms applied outside the intended SVG layer are not currently recognized (we should fix this at some point). For example, this won't work:

<svg ...>

1. Fzp files that specify a connector, but that connector isn't identified in the corresponding SVG. 2. Font references other than droid or ocra 10. I think we check images being imported to the parts editor for this, but assume our own images are correct. **Cc:** andre.knoerig@gmail.com stefanhermann79@googlemail.com lionel.m...@gmail.com
davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 11, 2011 08:56:48

Here's more detail about inkscape crap. This is a typical inkscape element:

<circle cx="13.65" cy="144" style="fill:#383838" r="1.4960001" id="circle32" d="m 15.146,144 c 0,0.82622 -0.669782,1.496 -1.496,1.496 -0.826218,0 -1.496,-0.66978 -1.496,-1.496 0,-0.82622 0.669782,-1.496 1.496,-1.496 0.826218,0 1.496,0.66978 1.496,1.496 z" sodipodi:cx="13.65" sodipodi:cy="144" sodipodi:rx="1.4960001" sodipodi:ry="1.4960001" />

Notice that there are both sodipodi:cx and cx. Well sometimes they are not the same, and if Fritzing is just parsing for "cx" it's not clear which one will come up first.

Plus it makes all the files about twice as large.

davidperrenoud commented 10 years ago

From irasc...@gmail.com on August 28, 2011 14:51:25

Owner: andre.knoerig@gmail.com
Cc: -andre.knoerig@gmail.com

davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 22, 2012 01:14:58

I now have a pretty good chunk of svg cleaning code running internally in Fritzing, but it involves repeated parsing of each svg when it is loaded. It would be nice to run this over all the svgs in the core in a one-time operation, replacing the affected core files, so that at load time we could skip running the cleaning code for core parts.

Cc: -lionel.m...@gmail.com irasc...@gmail.com

davidperrenoud commented 10 years ago

From irasc...@gmail.com on October 22, 2012 20:46:32

Owner: irasc...@gmail.com
Cc: -irasc...@gmail.com andre.knoerig@gmail.com
Labels: -Type-Defect Type-Enhancement

davidperrenoud commented 10 years ago

From irasc...@gmail.com on January 20, 2014 06:46:29

Since there is already a lot of fix-up svg code in Fritzing, could add this as part of the -db command-line option. Load each svg, run the cleanup code, and save the svg back out again.

Cc: -stefanhermann79@googlemail.com -andre.knoerig@gmail.com bluearc....@gmail.com

failiz commented 3 years ago

Move to the part repository?

failiz commented 3 years ago

Ping