Hi, I have a bit of a niche question:
For some context, I am working on an academic project in which I use machine learning to design bikes, and I am automatically generating CSV building spec files and would like to generate corresponding images without having to manually enter in hundreds of dimensions. I was wondering if there is a function to load a bike model based on a building spec export file. In case this isn't a feature, is there a good way to automatically edit/generate bikeCAD files to insert many dimensions? Thanks in advance for any insight!
In case it matters, I am using BikeCAD Pro 15.0, but can easily upgrade, of course. The software has been instrumental in the project so far, so I'm grateful to have it as a tool.
Regards,
Lyle
It is currently not an option to load a design in from a CSV file. However, it should be possible for you to generate your own BCAD files in the same way you are currently generating your own CSV file. BCAD files are simply XML properties files. As an exercise, you could open a BCAD file in a text editor and change some of the dimensions. If you then open up the BCAD file in BikeCAD, you should see that the design has changed. If you do choose to generate your own BCAD files, be aware that while changing some dimensions is only a matter of finding the property that controls that dimension and modifying it in the file, there are some properties that can mean different things depending on what menus are selected in BikeCAD. For example, the "BB textfield" property will store either the BB drop or the BB height. Which value it stores depends on the BB drop and BB height menu. That menu selection is stored in the property "BB measure style". "BB measure style" is 0 for BB drop and 1 for BB height.
There is a sample PHP script that will collect body dimensions and store them as a BCAD file at: bikecad.ca/get_fit_advisor_dims_thru_script. You could apply this concept to your own project.
Great! Thanks for that insight. Yes, that sounds like a good solution and I'll be excited to try it out.
Hi Brent,
Thanks again for the tips. I had some time to try out what you suggested. I think that editing the XML files should be quite doable, but there is one piece of the puzzle missing for me. As it turns out, the bike parameters in the XML file have different names than the entries of the CSV file. For example "Crank width at pedals" from the XML corresponds to "Components/Cranks C" in the CSV. I could probably manually deduce the correspondence, but this would be quite labor intensive. I was wondering if you have an easy way to generate a list of the corresponding XML entries associated with the CSV export entries (or perhaps already have one available). This would help me out immensely!
Regards,
Lyle
I do not already have a comprehensive listing of all the terms in the CSV file and their corresponding values in the XML (BCAD) file. I'm not sure how entrenched you are in the terms of the CSV file, but I think a simpler approach would be to convert the BikeCAD inputs into their corresponding BCAD file outputs rather than converting the CSV output into the BCAD output. The reason being that there are a number of input fields the meaning of which are dependant on a menu selection. As you are going through the various dialog boxes of the BikeCAD interface, you'll find that menu selection right next to the corresponding input field. The state of these menu selections are not always stored in the CSV output file.
Below, I've shown the Primary dimensions dialog box along with the corresponding XML properties from the BCAD output file.
- <entry key="Saddle height">Replace this text with the value for Saddle height</entry>
- <entry key="Seat angle">Replace this text with the value for Seat angle</entry>
<entry key="SADDLEPOSITIONMEASURESTYLE">1</entry>- <entry key="Saddle height">Replace this text with the value for Saddle from BB (X)</entry>
- <entry key="SaddleYfromBB">Replace this text with the value for Saddle from BB (Y)</entry>
<entry key="SADDLEPOSITIONMEASURESTYLE">2</entry>- <entry key="Saddle height">Replace this text with the value for Saddle clamp from BB (X)</entry>
- <entry key="ClmpYfromBB">Replace this text with the value for Saddle clamp from BB (Y)</entry>
<entry key="ST measure style">0</entry>- <entry key="Seat tube length">Replace this text with the value for Seat tube length (c-c)</entry>
<entry key="ST measure style">1</entry>- <entry key="Seat tube length">Replace this text with the value for Seat tube length (c-t)</entry>
<entry key="BB measure style">0</entry>- <entry key="BB textfield">Replace this text with the value for BB drop</entry>
<entry key="BB measure style">1</entry>- <entry key="BB textfield">Replace this text with the value for BB height</entry>
<entry key="CS measure style">0</entry>- <entry key="CS textfield">Replace this text with the value for Chain stay length</entry>
<entry key="CS measure style">1</entry>- <entry key="CS textfield">Replace this text with the value for Rear wheel gap</entry>
<entry key="Display SEATTUBEEXTENSION">true</entry>- <entry key="Seat tube extension">Replace this text with the value for Seat tube extension measured along edge</entry>
<entry key="Display SEATTUBEEXTENSION">false</entry><entry key="Head angle">73.0</entry>
<entry key="Top tube front center measure style">0</entry>- <entry key="FCD textfield">Replace this text with the value for Effective top tube length</entry>
- <entry key="Top tube angle textfield">Replace this text with the value for Top tube angle</entry>
<entry key="Top tube front center measure style">1</entry>- <entry key="FCD textfield">Replace this text with the value for Front center distance</entry>
- <entry key="Head tube length textfield">Replace this text with the value for Head tube length</entry>
<entry key="Top tube front center measure style">2</entry>- <entry key="FCD textfield">Replace this text with the value for Handlebar from BB (X)</entry>
- <entry key="Handlebar Y textfield">Replace this text with the value for Handlebar from BB (Y)</entry>
<entry key="Top tube front center measure style">3</entry>- <entry key="FCD textfield">Replace this text with the value for Reach</entry>
- <entry key="Stack">Replace this text with the value for Stack</entry>
<entry key="Top tube front center measure style">4</entry>- <entry key="FCD textfield">Replace this text with the value for Rider compartment (slanted)</entry>
- <entry key="BB to handlebar direct">Replace this text with the value for Handlebar from BB (direct)</entry>
<entry key="Top tube front center measure style">5</entry>Hi Brent,
Thanks for the prompt and detailed response. This helped me a great deal in better understanding the structure of the BCAD file. Yes, I agree that using the BCAD file in the first place to source my training data and working with the naming convensions of the BCAD file throughout the process would be beneficial. Unfortunately, a new issue arises with this. For context, a colleague of mine on the project downloaded a bunch of BCAD files from the Design Archive (Some great user supplied content there!). I do need this data to be standardized, though: i.e. my algorithm needs "Saddle Height" to refer to the same metric in each model of the dataset. While I could segment my data based on measurement type, this would not be ideal since I notice that there are a great many more such menu selection boxes across the software. Do you see a good way to convert these besides opening each file in the software and selecting each menu option? I also notice that you are not finished with your previous response, so perhaps this is something you were planning to address. My apologies in that case for jumping the gun on the reply.
As a side note, if you would prefer to continue this conversation via email, feel free to email me at the email this account is registered under (@mit.edu). I also envision a couple ways that our research may eventually be of interest to you (perhaps a "generate random bike" feature?). Just ideas of course! Happy to discuss such concepts with you as well if you are interested.
Regards,
Lyle
It took me a while to itemize all the XML properties, but my response above is now complete. The lines in bold are the ones that would represent the chosen fields in the above screen capture. The lines not shown in bold would represent the fields that would apply if other menu choices were made. Note that the three tube extension fields are associated with toggle buttons that allow you define tube extensions measured along the edge of the tube or along the centerlines of the tube. The toggle buttons are linked so when one changes, the other two change as well. Therefore, there is only one XML property storing the state of the three toggle buttons.
There is currently no automatic way to convert BCAD files so they all use the same menu option for Saddle position. I have had a request to read in a number of BCAD files as a batch and export a PDF for each one. I am open to doing this sort of thing for your project, but I would want to make sure I understand your objectives completely so I can get you what you need.
I see. Thanks again for taking the time to create such a detailed response here. And it's good you noted the toggle buttons, as I was completely unaware of that feature! I think that I have the necessary info now to program a set of parameters into the BCAD file, so I'm all set on that front. However, I am still in a bit of a bind regarding the menu option types, as I think I will have to standardize every file to use the same menu selections for optimum results. The software obviously converts the values when the user switches the preferred measurement type. Is this conversion process as simple as accessing a hard-coded formula somewhere in the files of the BikeCAD software? If there is a list of such formulas (assuming they use familiar variable names), I can probably convert all the dimensions on my end and I should be good to go.
Regarding a point you mentioned about batch file exports, I was actually able to automate the exporting of large numbers of files using a script I wrote to run on top of BikeCAD. Creating a similar script to open each file and reprogram all the menus would be a bit of a stretch though. Anyways, long story short, I probably wouldn't get a ton of benefit from a built in batch export feature.
Regarding my specific objectives, the overarching goal is to use neural networks (likely physics-informed generative adversarial networks) to generate novel high-performance bikes. For now though, I simply want to use a basic autoencoder algorithm to generate new bike models based on example models from the design archive and visualize these in the software. This requires the dataset to have a uniform parameterization system since the algorithm isn't "smart" enough to handle different parameterizations in different ways. I should also note that the number of training files is in the thousands, so any manual operations are out of the quesion, unfortunately.
While it would be straight forward to convert BB height to BB drop, most of the other menus are a lot more involved and would depend on the state of various other menus. It wouldn't be that much trouble for me to add a feature to BikeCAD that would, after reading in a BCAD file, automatically switch all menus to a standard configuration. It might not be something I'll want to include in future updates of BikeCAD, but I could just whip off a modified version for your project. Feel free to email me with a list of the menus you'd like standardized.
Alright, Ill shoot you an email. Thanks again!
edit: I am realizing now that I am approaching a point where I have to make some decisions regarding what features I want to include in the algorithm. If you wouldn't mind giving me a day or two to deliberate and discuss with my colleagues, that would be great, and I will reach out to you then.
No rush at my end. Looking forward to hearing from you when you're ready.