How do I import .obj or other models files into p5.js - p5.js

So What I want is an .OBJ file in my plane Sim that is the main simulator(The plane), I make a small cube to test if it will work, and when I try to insert the file. It does not give me an option to load it.
I first tried this when looking at TheCodingTrain's tutorial, in the tutorial, when adding a new file, there was a Dropbox where he could insert the file he wanted, but I use the standard p5.js web editor format and it does not give me the option or Dropbox, and when I type the name of the file, It tells me that It does not except the .OBJ file type.

It's difficult to understand your question since you don't link to the CodingTrain tutorial in question and the references to "Dropbox" (a totally separate service that you could use to host files, but not necessarily load them in a p5.js sketch) are very confusing.
However, uploading files and loading 3d models in the p5js web editor is quite straightforward:
Expand the "Sketch files" panel
Click the down arrow menu in the top right of the "Sketch files" panel
Select the "Upload file" option
Either Drag and Drop your .obj file or click to open the file browser and select it.
Here's an example

Ok, now I know why this was not happening, it seems that I was not logged in when I am uploading my files, I always log in only to save my projects before my classes end.

Related

Impossible to reference an image from the Assets Folder

I am currently building a Windows Universal App and the learning curve is OK. I get a response from my webservice, parse the JSON, display info in the app, but my current issue is the following one:
I tried to display an image that I put in the Assets folder, but this doesn't seem to work.
This is my layout:
As you can see, the text "Test" is correctly displayed but not the images.
On the right side, in the explorer pannel, I cannot see the files that should be here:
WHAT I HAVE TRIED:
In my example, they are in the Assets/picto folder, but I have also tried the root directory Assets, as wal as creating Image folder at the same level.
I have definitely no idea how to add a simple picture, so any help is appreciated!
Adding items in Windows explorer to the right location doesn't add them to your solution / deployment.
You have to right-click the picto folder -> Add > -> Add existing item. Your items are not even in your solution, so they won't show up on the layout screen.
Make sure you set the correct build target for each image.
If an image shouldn't show up, even through it's in your solution, this is often the reason.

Delphi XE6 - How to make user defined components image show up on the pallette

I am migrating from 2007 to XE6 and have several user defined components written by both myself and third party.
When installing components in delphi 2007 you just add the components to the library and it automatically found and loaded the DCR of the same name into the dpk file and it loaded the image onto the pallette.
In delphi XE6 is does not automatically load the image files, instead you just get a default image which is the same for every user defined component.
I sought and found some topics on this subject which described manually adding the DCR files into the project source which I have done but it does not work and/or it is unreliable.
Firstly when I reinstall the bpl, the samples pallette (which I have loaded all my components into) deletes all the components I have just installed and shows nothing.
When I shut down Delphi and restart, the components appear on the pallete but randomly some of the images are still the default images.
I get a different result, every time I re-intall the bpl, each time different images have the correct image and others have the default image. It appears quite random which ones don't appear.
Any clues what is going on?
I think I found a work around for this problem.
I noticed that I have SynEdit loaded and it does not have any problem with putting its Icons on the palette, so I loaded up the dpk to see how it did it.
It seems that the problem exists when each component is added as a seperate file to the library.
The key is to make just one file eg MyLibReg.pas and add each component file into the "Uses" section of the unit. Create the Register procedure and then register all the components in one go in the Register procedure. You will have to go through each file, find the individual register procedures, copy and paste the class names into MyLibReg.pas's register procedure then REM out those procedures in those files.
Next, load up image editor and create a new dcr file called MyLibReg.dcr.
The next bit is a bit tedious, load up all the dcr files from all your user components into image editor and copy and paste the images into MyLibReg.dcr, you will need to create all the bitmap names manually then paste the images in.
Save the dcr in the same directory as MyLibReg.pas.
In XE6 select Component/Install Component, Select "Install Into new package".
in unit filename navigate to MyLibReg.Pas and continue and build/install the package.
Voila, all the correct icons come up.
It seems XE6 can only reliably work with one dcr file per bpl.

Changing Where CKEditor Looks for Images

I am wondering if there is some way to change where CKEditor looks for images. Right now it uses the location of the web page containing the editor as the root directory but I would like to write a javascript function that can change this directory to any arbitrary path passed to the function.
The bigger picture for this is that I'd like to extend the functionality of CKEditor to be able to save the source it creates to whatever location is picked by the user. I've already implemented getting the source and saving it using wxWidgets but am having trouble getting CKEditor to change its working directory so that images can be included from the directory the user picks.
I've tried using some of the properties like baseDir, basePath, and baseHref to make this possible but as far as I can tell none of them quite do what I'm looking for.
So the process would be:
(1) The user picks a directory where the source will be saved
(2) The user creates a page using CKEditor where images from the directory chosen can be included AND DISPLAYED in CKEditor
(3) The user saves the source of their page to the chosen directory (the source saved here should use the relative path to the images because the source is now located in the same directory as the images it includes)
I realize this is a rather unconventional use of CKEditor but if someone might be able to kick me in the right direction to making this happen, I'd really appreciate it.
EDIT:
So after a little experimenting and changing some backslashes to regular slashes, it looks like the baseHref attribute does what I'd like. I've still not been able to change its value at runtime though as I would like. Does anybody know if this is possible with CKEditor? I'd still like to have a javascript function that I can pass a path to and have it change this baseHref value. Right now I have set its value in config.js.
If this isn't possible, I know you can read and write the source in and out of the editor. So I would like to resort to reading and storing the source from the editor, reloading CKEditor with a new config.baseHref, and then writing the source back into the editor. Does anyone know if the CKEditor api provides functionality to reload its configuration?
Thanks.
I don't expect too many people will be trying to do what I was doing here since CKEditor is usually hosted on a server somewhere, but in case someone finds it helpful, here's what I ended up doing.
As I mentioned in the edit to my question, modifying the baseHref gave me the functionality of prepending the image filename with the directory path leading to it. I wasn't able to find a way to modify it while the editor was running so I ended up telling CKEditor to load an external configuration file each time it started with the line
config.customConfig = 'C:/Users/kenwood/Desktop/MarkCreator2/ckeditor/custom_config.js';
Then I used C++ to write new contents to custom_config.js any time I wanted to switch directories.
Unfortunately this method meant I had to read the contents out of the editor, refresh the page, and then write the editor contents back in any time I wanted to change directories. This was adequate for what I needed though.

Image of the object within .STL File

Please take a look on the website http://quotes.rapidprototype.com.au/upload/ and upload STL File and press "Start Upload" button. You shall see the image of the object within the stl file as (.png) image. I want the same functionality(The image of the of the object within the stl file, rest of the work i can do). I want to get the image in .png or .jpr or .gif format as a 2D image. I want that the user can see the image of the object within the stl file that he/she uploads. I am using PHP.
Please assist me how can I achieve this using PHP. I shall be very thank full to you.
You could use ParaView www.paraview.org in the backend. This is free and reads stl as well as having the ability to save images. There is a python interface, so you can program it to do various things (starting by tracing your actions in the GUI). You can also give it options from the command line. ParaView has a web component, but it would probably be easier just to have PHP do a system call and look for the resulting image.
Test that it works on the command line before wrapping it in PHP

How to use the existing Png-Shell-Thumbnail for my file types?

I am currently writing an application working with specially prepared image data. Another tool prepares the images (basically PNGs with additional data stored in the meta-data section). Now my tool works with these files, but not with all PNGs, so "we" decided to use a different file extension. So far, so good.
Now, because I am a lazy sack I implemented some file type registration to allow double-clicking on the file and opening it in my application (no problem at all).
And here is my Question:
It would be cool if the windows explorer could still show me the thumbnail previews for my files. Since they basically are still PNG files, it should be possible without writing my own shell extension (at least I believe so).
I quickly tried to copy all registry keys and values from HKCR.png to HKCR.mInDat (my file name ext) and it worked. However, I would prefere knowning what I am doing ;-)
Which of the registry settings are responsible for the thumbnail preview control and which can I use to get the preview for my file types?
I tried to google it, but I failed, since it seems I am unable to come up with the right buzz-words to find the info I need. Please, help me.
Thank you!
Yours,
3of4
Simple:
[HKEY_CLASSES_ROOT\.apng]
#="apng"
"Content Type"="image/png"
"PerceivedType"="image"
[HKEY_CLASSES_ROOT\apng\shellex\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
#="{3F30C968-480A-4C6C-862D-EFC0897BB84B}"

Resources