based on this script
i improved it for creating a .ldr template from peeron.com online database
we just need to enter something like
sdlBrt templatefrompeeronwebsite.sdlbas 293-1
and then the script downloads the respective peeron.com webpage ( http://peeron.com/inv/sets/293-1 in this case - i'm only using peeron for now, it seems far easier for extracting information ), extracts the parts inventory information from there, creates a .ldr file, and opens LeoCad with that
curl (for downloading the webpage, weirdly wget doesn’t work) and grep (for "cleaning" the html page) are needed as dependency (on Ubuntu and Debian, grep comes preinstalled, curl needs to be installed, like from "sudo apt install curl") - cat and rm are very known gnu-tools! ;)
model$="210-1" '- default model used when no model is added in the command line argument
if argv(2)<>"" then: model$=argv(2):end if
shell("curl http://www.peeron.com/inv/sets/"+model$+" > tmp1.html")
shell("cat tmp1.html | grep td | grep href | grep part > tmp2.html")
shell("rm tmp1.html")
finp$="tmp2.html"
function lstinf$(a$,b$,c$)
adra=1:adrb=1:blngt=len(b$):d$=""
while adrb<=blngt
if mid$ (a$,adra,1)=mid$ (b$,adrb,1) then:adrb+=1:end if
adra=adra+1
end while
while mid$(a$,adra,1)<>left$(c$,1)
d$=d$+mid$(a$,adra,1):adra=adra+1
end while
lstinf$=d$
end function
fout$=model$+".ldr"
open finp$ for input as #1:open fout$ for output as #2
dst=100:vamt=0
while eof(1)=0
setcaption(finp$+"line:"+str$(vamt))
file input #1,trln$
trln$="> "+trln$+" 0 0 0 "
amnt$=lstinf$(trln$,"><td>","<td>")
prtn$=lstinf$(trln$,"><td><td><td><a>","<a>")
clrk$=lstinf$(trln$,"><td><td><td><a><a><td><td>","<td>")
v2=val(amnt$)
'----- this list is still way incomplete
'----- old solid colours: 0..2,4,7,14..15,
if lcase$(clrk$)="black" then:clrk$="0":end if
if lcase$(clrk$)="blue" then:clrk$="1":end if
if lcase$(clrk$)="green" then:clrk$="2":end if
if lcase$(clrk$)="red" then:clrk$="4":end if
if lcase$(clrk$)="grey" then:clrk$="7":end if
if lcase$(clrk$)="oldgray" then:clrk$="7":end if
if lcase$(clrk$)="lightgray" then:clrk$="7":end if
if lcase$(clrk$)="yellow" then:clrk$="14":end if
if lcase$(clrk$)="white" then:clrk$="15":end if
if lcase$(clrk$)="multi" then:clrk$="15":end if
'----- translucent colours: 33..47,52,54,57,
if lcase$(clrk$)="transdarkblue" then:clrk$="33":end if
if lcase$(clrk$)="trdkblue" then:clrk$="33":end if
if lcase$(clrk$)="transgreen" then:clrk$="34":end if
if lcase$(clrk$)="trgreen" then:clrk$="34":end if
if lcase$(clrk$)="transbrightgreen" then:clrk$="35":end if
if lcase$(clrk$)="trbtgreen" then:clrk$="35":end if
if lcase$(clrk$)="transred" then:clrk$="36":end if
if lcase$(clrk$)="trred" then:clrk$="36":end if
if lcase$(clrk$)="transdarkpink" then:clrk$="37":end if
if lcase$(clrk$)="trdkpink" then:clrk$="37":end if
if lcase$(clrk$)="transneonorange" then:clrk$="38":end if
if lcase$(clrk$)="trneonorange" then:clrk$="38":end if
if lcase$(clrk$)="transverylightblue" then:clrk$="39":end if
if lcase$(clrk$)="transblack" then:clrk$="40":end if
if lcase$(clrk$)="trblack" then:clrk$="40":end if
if lcase$(clrk$)="smoke" then:clrk$="40":end if
if lcase$(clrk$)="transmdediumblue" then:clrk$="41":end if
if lcase$(clrk$)="trmdblue" then:clrk$="41":end if
if lcase$(clrk$)="transneongreen" then:clrk$="42":end if
if lcase$(clrk$)="trneongreen" then:clrk$="42":end if
if lcase$(clrk$)="translightblue" then:clrk$="43":end if
if lcase$(clrk$)="trltblue" then:clrk$="43":end if
if lcase$(clrk$)="translightpurple" then:clrk$="44":end if
if lcase$(clrk$)="trltpurple" then:clrk$="44":end if
if lcase$(clrk$)="transpink" then:clrk$="45":end if
if lcase$(clrk$)="trpink" then:clrk$="45":end if
if lcase$(clrk$)="transyellow" then:clrk$="46":end if
if lcase$(clrk$)="tryellow" then:clrk$="46":end if
if lcase$(clrk$)="transparent" then:clrk$="47":end if
if lcase$(clrk$)="transclear" then:clrk$="47":end if
if lcase$(clrk$)="trclear" then:clrk$="47":end if
if lcase$(clrk$)="clear" then:clrk$="47":end if
if lcase$(clrk$)="transpurple" then:clrk$="52":end if
if lcase$(clrk$)="trpurple" then:clrk$="52":end if
if lcase$(clrk$)="transneonyellow" then:clrk$="54":end if
if lcase$(clrk$)="trneonyellow" then:clrk$="54":end if
if lcase$(clrk$)="transorange" then:clrk$="57":end if
if lcase$(clrk$)="trorange" then:clrk$="57":end if
'----- recent solid colours: 3,5..6,8..13,16..20,22..23,25..31,92,
if lcase$(clrk$)="darkturquoise" then:clrk$="3":end if
if lcase$(clrk$)="dkturquoise" then:clrk$="3":end if
if lcase$(clrk$)="darkpink" then:clrk$="5":end if
if lcase$(clrk$)="dkpink" then:clrk$="5":end if
if lcase$(clrk$)="brown" then:clrk$="6":end if
if lcase$(clrk$)="darkgray" then:clrk$="8":end if
if lcase$(clrk$)="dkgray" then:clrk$="8":end if
if lcase$(clrk$)="lightblue" then:clrk$="9":end if
if lcase$(clrk$)="ltblue" then:clrk$="9":end if
if lcase$(clrk$)="brightgreen" then:clrk$="10":end if
if lcase$(clrk$)="btgreen" then:clrk$="10":end if
if lcase$(clrk$)="lightturquoise" then:clrk$="11":end if
if lcase$(clrk$)="ltturquoise" then:clrk$="11":end if
if lcase$(clrk$)="salmon" then:clrk$="12":end if
if lcase$(clrk$)="pink" then:clrk$="13":end if
if lcase$(clrk$)="maincolour" then:clrk$="16":end if
if lcase$(clrk$)="lightgreen" then:clrk$="17":end if
if lcase$(clrk$)="ltgreen" then:clrk$="17":end if
if lcase$(clrk$)="lightyellow" then:clrk$="18":end if
if lcase$(clrk$)="ltyellow" then:clrk$="18":end if
if lcase$(clrk$)="tan" then:clrk$="19":end if
if lcase$(clrk$)="lightviolet" then:clrk$="20":end if
if lcase$(clrk$)="ltviolet" then:clrk$="20":end if
if lcase$(clrk$)="purple" then:clrk$="22":end if
if lcase$(clrk$)="darkblueviolet" then:clrk$="23":end if
if lcase$(clrk$)="dkblueviolet" then:clrk$="23":end if
if lcase$(clrk$)="orange" then:clrk$="25":end if
if lcase$(clrk$)="magenta" then:clrk$="26":end if
if lcase$(clrk$)="lime" then:clrk$="27":end if
if lcase$(clrk$)="darktan" then:clrk$="28":end if
if lcase$(clrk$)="dktan" then:clrk$="28":end if
if lcase$(clrk$)="brightpink" then:clrk$="29":end if
if lcase$(clrk$)="btpink" then:clrk$="29":end if
if lcase$(clrk$)="mediumlavender" then:clrk$="30":end if
if lcase$(clrk$)="mdlavender" then:clrk$="30":end if
if lcase$(clrk$)="lavender" then:clrk$="31":end if
'----- more recent solid colours: 68..?..92,
if lcase$(clrk$)="verylightorange" then:clrk$="68":end if
if lcase$(clrk$)="reddishbrown" then:clrk$="70":end if
if lcase$(clrk$)="redbrown" then:clrk$="70":end if
if lcase$(clrk$)="flesh" then:clrk$="92":end if
'----- more recent solid colours: 100..?..503,
if lcase$(clrk$)="lightsalmon" then:clrk$="100":end if
if lcase$(clrk$)="ltsalmon" then:clrk$="100":end if
if lcase$(clrk$)="mediumlime" then:clrk$="115":end if
if lcase$(clrk$)="mdlime" then:clrk$="115":end if
if lcase$(clrk$)="lightlime" then:clrk$="120":end if
if lcase$(clrk$)="ltlime" then:clrk$="120":end if
if lcase$(clrk$)="rust" then:clrk$="216":end if
if lcase$(clrk$)="brightlightyellow" then:clrk$="226":end if
if lcase$(clrk$)="btltyellow" then:clrk$="226":end if
if lcase$(clrk$)="maerskblue" then:clrk$="313":end if
if lcase$(clrk$)="darkorange" then:clrk$="484":end if
if lcase$(clrk$)="dkorange" then:clrk$="484":end if
if lcase$(clrk$)="verylightgray" then:clrk$="503":end if
'----- special colours: 21,24,
if lcase$(clrk$)="glowindarkopaque" then:clrk$="21":end if
if lcase$(clrk$)="unknown" then:clrk$="24":end if
'----- unknown
if lcase$(clrk$)="mdstone" then:clrk$="24":end if
'-----
for l2=1 to v2
stou$="1 "+clrk$+" "+str$(vamt*dst)+" -24 "+str$((l2-1)*dst)+" 1 0 0 0 1 0 0 0 1 "+prtn$
print #2,stou$
next
vamt=vamt+1
wend
close #1:close #2
shell("rm tmp2.html")
shell("leocad "+model$+".ldr")
of course the script needs to be improved a lot! :D - but it is really a "productivity booster" for me, and all lego-cad developers are welcome on including it (or something like or far better than it! :D ) as feature or plugin, since the result is really a huge time saver! ;)