fai, correct! The voltages are “hard coded” in the dropdown menu using the procedure I outlined above. Wondering if the underlying xml property code could be edited in order to enable the option for a user to enter any value “on the fly” as can be done with resistors. But I haven’t figured out how to access or even view the xml property code for a part. Can you tell me how to do that?
It is in the .fzp file. This tutorial may help somewhat (although this is a bit out of scope):
to obtain the .fzp file unzip your fzpz file the fzp is one of the files zipped in there.
<module moduleId="hanmatek-HM305_2-CapacitorModuleID" referenceFile="hanmatek-HM305_2.fzp" fritzingVersion="1.01">
You likely need to add the CapacitorModuleID to the module id as that is what enables the code. Then the properties are in the properties section of the .fzp file (this is from the power supply .fzp file posted above)
<properties>
<property name="variant">variant 1</property>
<property name="family">Hanmatek HM305</property>
<property name="voltage">showInLabel=“yes” 9V</property>
<property name="internal resistance">0.1Ω</property>
<property name="layer"/>
</properties>
the voltage and internal resistance properties are the ones of interest.
Peter
shouldn’t that be:
<properties>
<property name="variant">variant 1</property>
<property name="family">Hanmatek HM305</property>
<property name="voltage" showInLabel=“yes”>9V</property>
<property name="internal resistance">0.1Ω</property>
<property name="layer"/>
</properties>
“showInLabel” should be an attribute, not part of the data.
With general part building, I have found that to be able to have maximum control to edit property values, they need to be defined in the fxp file without an initial value. This could interact with the ‘special’ module id logic. Try one, or combinations, of:
<property name="voltage"/>
<property name="voltage"></property>
<property name="voltage" showInLabel="yes"/>
I have never tried show in label combined with an empty property.
Defining empty properties allows anything to be filled in. However, if spice is referencing the property something appropriate will need to be supplied.
Yes, but correcting that causes this error on parsing
char 42 is the start of the “yes” in this line
<property name="voltage" showInLabel=“yes”>9V</property>
the original added showInLabel=“yes” to the 9V value in Inspector the new one dies on load.
Peter
One of the copy/paste/edit steps changed the “normal” quote into a word process quote character. Just change back to the standard quote characters around that “yes”.
"yes" versus “yes”
AH! Thanks that makes more sense.
Peter
I am not sure what is the advantage of empty properties. However, I saw that empty properties can cause unwanted behaviors in the cases that you describe: 1) When it is a property used by the simulator (simulation will fail or give wrong results) and 2) When showing the property. I remember that the resistors did not specify the power and the label was “R3\n220OHM\nW”. The power was not set using the properties defined in the resources file by default. So, I prefer to give a default value.
@vanepp , I am not sure about the “layer” property. Is it necessary?
Yes, I don’t remember exactly what but something fails if the layer isn’t there.
Peter
I could not reproduce that here. It works as expected without the layer property.
hanmatek-HM305 (1).fzpz (5.4 KB)
It may not matter in this particular case. I think (but am not sure) it affects pcb and this part doesn’t have pcb. It is however safer to have it in if it doesn’t cause some other problem.
Peter
Empty properties are always editable in inspector. In cases I tested, if a property as a value filled in, in the fxp, it can only be changed to a value that is in another version of the part. It triggers a part swap. Other than special cases like the resistors. I did not find another way to force a property to be editable.
I never saw that behavior. I tried to replicate that and it does not work in Fitzing 1.0.1 (Windows). I tried to change the power supply part to achieve that you can change the voltage in the inspector pane without being able to reproduce it.
<properties>
<property name="variant">variant 1</property>
<property name="family">Hanmatek HM305</property>
<property name="voltage"/>
</properties>
hanmatek-HM305 (1).fzpz (5.3 KB)
@microMerlin , can you edit the voltage property? Did I misunderstand anything?
Apparently I misremembered. No I can not edit the voltage, and my new tests did not find a way either. Exploring, I could only get part number to edit directly. To change anything else needed multiple parts with different values that inspector would swap using the drop down.
I must have been remembering parts of a conversation about what is needed. Something like an editable=“yes” attribute of properties.
No worries. Yes, part number is always editable.
Yes, that’s one way. The other is to use the specific moduleIDs that support editable properties as defined in resources/properties.xml (e.g., voltage and capacitance for CapacitorModuleId). But to support new editable properties, is is necessary to change that file and compile Fritzing.
I think you suggested that editable=“yes” in some open issue in the bug tracker