Hello Sandrine,
I'd like to write a script code that automatically changes the parameters of the schemmatics in xcircuit example that does this: g / pMOS $ / s/analoglib3 :: pMOS / analog :: PMOS2 / g. Are possible? If yes how can I do it.
First, please note that these are not "parameters". . . they are the actual objects being used (in SPICE, the model name would be a parameter, but in a schematic editor, typically there will be a different symbol used for different models). The following simple unix shell script will make the substitution: #!/bin/sh cat ${1%.ps}.ps | sed -e "/pMOS\$/s/analoglib3::pMOS/analog::pmos2/g" \ > ${1%.ps}_new.ps Save this script as, say, "mod.sh", then do "chmod a+x mod.sh"; then you can do (using your original example file) "mod.sh Master2.ps". This will create a new file "Master2_new.ps" with the substitutions. However, this will create an invalid postscript file, because the file now makes reference to a symbol "analog::pmos2" that is not defined in the same file. A better way is to use xcircuit in batch mode. This requires the latest revision of xcircuit-3.8, because I only put in the command to replace one object with another after your original email. That script would look like this: #!/bin/csh -f if ( $# == 0 ) then echo "Please specify an xcircuit filename." exit endif xcircuit -noconsole -nowindow << EOF page load $1 set p [object parts] foreach e \$p { if {[element \$e type] == "Object Instance"} { set n [element \$e object] if {\$n == "analoglib3::pMOS"} { element \$e object analog::pmos2 } } } deselect page save ${1:r}_new quit Save this script as, say, "mod2.sh", then do "chmod a+x mod2.sh"; then you can do "mod2.sh Master2.ps", and it will produce a valid output file called "Master2_new.ps" with all the objects correctly defined within the same file. This is worth posting to the xcircuit-dev email list because I don't think there are a lot of people who know how to write batch processing scripts for xcircuit. Probably there are a lot of people who don't even know that it's possible to write batch processing scripts for xcircuit. I should write a tutorial on it. . . Hopefully this solves your problem. Regards, Tim +--------------------------------+-------------------------------------+ | R. Timothy Edwards (Tim) | email: t...@opencircuitdesign.com | | Open Circuit Design | web: http://opencircuitdesign.com | | 22815 Timber Creek Lane | phone: (301) 528-5030 | | Clarksburg, MD 20871-4001 | cell: (240) 401-0616 | +--------------------------------+-------------------------------------+ _______________________________________________ Xcircuit-dev mailing list Xcircuit-dev@opencircuitdesign.com http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev