how to get j3d loader? - stl

I'm doing a java 3D library regarding drawing different kind of shapes and generate them into an STL file. As I'm trying to code my STLFile class I found some import which I don't really understand. Can someone tell me where can I find the Loader or the library and how to use those import.
Below is the code that I found which I don't understand.
import com.sun.j3d.loaders.Scene;
import com.sun.j3d.loaders.SceneBase;
import com.sun.j3d.loaders.IncorrectFormatException;
import com.sun.j3d.loaders.ParsingErrorException;
import com.sun.j3d.utils.geometry.GeometryInfo;
. . .
public class STLFile implements Loader
{
. . .
}
There are more code but I 'm just showing the part which I not sure.
Thank you.

Rather look at org.jogamp.java3d.loaders and org.jogamp.java3d.utils.geometry. You can download Java 3D here. I advise you to read my article to know how to get started with Java 3D.

Related

How do I import the Three.js Line library as an ES6 module?

I do my development using modern JS (ES6) which means modules.
Although Three.js is available as an ES6 module. The line library - LineSegmentsGeometry, LineGeometry, LineSegments2, etc. - is not.
What are my options here?
You have a couple options.
First and foremost, edit the code.
You're welcome to modify the code, and so you could manually turn it into an ES6 module. You would want to remove any references of THREE, and export anything that was normally attached to that object. You'll also need to import any required core THREE.js components, like Mesh, Vector3, etc.
The way I prefer to do this is to copy the file I'm updating locally, and change references to it. For example:
// local_three_modules/LineSegments2.js
import { Mesh, Vector3, etc. } from "three"
let LineSegments2 = function ( geometry, material ) {
// ...
}
export default LineSegments2
// app.js
import { Mesh, Vector3, etc. } from "three"
import LineSegments2 from "./local_three_overrides/LineSegments2.js"
// and so on...
Your other option is to use a bundler with an export loader.
Webpack (and other bundlers, I'm just more familiar with Webpack) provides a exports-loader which can be used against specific files that don't export anything. For example, you can tell the exports-loader to export THREE from LineSegments2.js. To get webpack involved in this process, you need to tell it to use the loader on the file. You can do this through the webpack configuration, or inline in the code like this:
import THREE from "exports-loader?THREE!./node_modules/three/examples/js/lines/LineSegments2.js"

The definition of base class FlxGame was not found

I'm getting an error where FlxGame can't be found.
I am importing it and it's in the src folder. I copied the org folder from AdamAtomic-flixel-8989e50 into src. I'm writing this in FlashDevelop.
This is the error message:
C:\Users\***\Documents\Pong\src\Pong.as(8): col: 28 Error: The definition of base class FlxGame was not found.
Loading configuration file C:\Users\***\AppData\Local\FlashDevelop\Apps\flexsdk\4.6.0\frameworks\flex-config.xml
And this is my AS3 class:
package
{
import org.flixel.*;
/**
* ...
* #author ***
*/
public class Pong extends FlxGame
{
public function Pong()
{
super(320, 240, MenuState, 2);
}
}
}
I think the easiest solution would be to use the same file structure used in most Flixel example projects. You should keep it in your org folder.
Otherwise, maybe try changing your import statement to:
import src.flixel.*
It looks like you are in the early stages of making your game. If this is your first time with Flixel, I highly recommend this tutorial.
Download the tutorial files and open it as a project in FlashDevelop (look for the file ending in .as3proj).
Or look for any other Flixel example projects. If you're like me, you'll find it easier to start from a demo game and edit the existing code/build on it. This way you don't have to worry about configuring folder paths, etc. and the game runs from the very beginning. Makes it a lot less frustrating :)

import issue of "serialization.json.JSON" class in actionscript:

I'm working on a project using actionscript and Flex. For some reason I have a problem importing the com.adobe.serialization.json.JSON class.
When I'm working only with the FlexSDK files and try to use it I'm getting
the following error:
Error:(142, 70) [..]: Error code: 1120: Access of undefined property
JSON.
And of course IntelliJ marks this file and the import in red.
On the other hand when I import the corelib.swc that includes this file I get the following error:
Error:[..]: Can not resolve a multiname reference unambiguously. JSON
(from /Volumes/backup/FlexSDK/frameworks/libs/air/airglobal.swc(JSON,
Walker)) and com.adobe.serialization.json:JSON (from
/Volumes/backup/.../libs/corelib.swc(com.adobe.serialization.json:JSON))
are available.
What is going on here? How can I solve this?
JSON is a top level class available in all the scopes since FP11. Trying to import any class with name JSON will result in an error. If (for some reason) you really do not want to use the already available JSON class and instead import a custom one you'll have to rename it.
Using Intellij, the best you can do is use the JSON class from the current SDK that you have, it has the methods parse() and stringify(). those two methods do the same as the corelib methods for the json.
In case you wanted to use the com.adobe.serialization.json.JSON it will enter in conflict with the one declared in the SDK.
Hope the information is useful

AS3 text to file

I'm making a game in cs3 using as3. I've seen dozens of tutorials, but none of them are working for me.
I found the simplest code I could, and it still gives me an error "1061: Call to a possibly undefined method save through a reference with static type flash.net:FileReference."
here's the code I'm using:
var file:FileReference = new FileReference();
file.save("this is a text", "file.txt")
Are you importing FileReference? If not, you'll need:
import flash.net.FileReference;
..inside your package declaration (or at the top of your block of code if you're coding on the time line)
With that import included, your code works for me.

Flash 11.2 sdk definition of base class Sprite was not found

I'm trying to build a simple sample project using FlashDevelop using Flash 11.2. For some reason it wont let me extend Sprite. When I try to compile it just says:
col: 31 Error: The definition of base class Sprite was not found.
All I have in my code is:
public class Game extends Sprite
{
}
Make sure that you have the following setup in your Flex SDK installation correctly:
\frameworks\libs\player\11.2\playerglobal.swc
and that you have a compiler constant called "swf-version=15" set in FD.
If that doesn't solve it, you have an ambiguous path to your libs. May they have spaces or special characters in them.
Did you import the right package? flash.display.Sprite
You put starling-framework as a tag so if you're using Starling it should be:
import starling.display.Sprite;