本文整理汇总了C#中Engine3D.Object3d.LoadSTL方法的典型用法代码示例。如果您正苦于以下问题:C# Object3d.LoadSTL方法的具体用法?C# Object3d.LoadSTL怎么用?C# Object3d.LoadSTL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine3D.Object3d
的用法示例。
在下文中一共展示了Object3d.LoadSTL方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public List<Object3d> Load(string filename)
{
string ext = Path.GetExtension(filename).ToLower();
// special loaders
foreach (ModelLoaderType loader in m_loaders)
{
if (ext == loader.FileExtension)
return loader.LoadModel(filename);
}
// built in loaders
Object3d obj = new Object3d();
bool ret = false;
if (ext.Equals(".dxf"))
{
ret = obj.LoadDXF(filename);
}
if (ext.Equals(".stl"))
{
ret = obj.LoadSTL(filename);
}
if (ext.Equals(".obj"))
{
ret = obj.LoadObjFile(filename);
}
if (ext.Equals(".3ds"))
{
ret = obj.Load3ds(filename);
}
if (ret == true)
{
List<Object3d> objlist = new List<Object3d>();
objlist.Add(obj);
return objlist;
}
return null;
}
示例2: LoadModel
/// <summary>
/// Loads a model, adds it to the 3d engine to be shown, and raises an app event
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
public bool LoadModel(String filename)
{
try
{
Object3d obj = new Object3d();
string ext = Path.GetExtension(filename);
bool ret = false;
ext = ext.ToLower();
if (ext.Equals(".dxf"))
{
ret = obj.LoadDXF(filename);
}
if (ext.Equals(".stl"))
{
ret = obj.LoadSTL(filename);
}
if (ext.Equals(".obj"))
{
ret = obj.LoadObjFile(filename);
}
if (ext.Equals(".3ds"))
{
ret = obj.Load3ds(filename);
}
if (ret == true)
{
m_engine3d.AddObject(obj);
m_selectedobject = obj;
m_slicefile = null; // the slice file is not longer current
RaiseAppEvent(eAppEvent.eModelAdded, "Model Loaded");
}
else
{
RaiseAppEvent(eAppEvent.eModelNotLoaded, "Model " + filename + " Failed to load");
}
return ret;
}
catch (Exception ex)
{
DebugLogger.Instance().LogRecord(ex.Message);
return false;
}
}
示例3: LoadModel
public bool LoadModel(String filename)
{
try
{
Object3d obj = new Object3d();
if (obj.LoadSTL(filename) == false)
{
return false;
}
else
{
m_engine3d.AddObject(obj);
m_selectedobject = obj;
m_slicefile = null; // the slice file is not longer current
}
RaiseAppEvent(eAppEvent.eModelLoaded, "Model Loaded");
return true;
}
catch (Exception ex)
{
DebugLogger.Instance().LogRecord(ex.Message);
return false;
}
}
示例4: LoadModel
/// <summary>
/// Loads a model, adds it to the 3d engine to be shown, and raises an app event
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
public bool LoadModel(String filename)
{
try
{
Object3d obj = new Object3d();
string ext = Path.GetExtension(filename);
bool ret = false;
ext = ext.ToLower();
if (ext.Equals(".dxf"))
{
ret = obj.LoadDXF(filename);
}
if (ext.Equals(".stl"))
{
ret = obj.LoadSTL(filename);
}
if (ext.Equals(".obj"))
{
ret = obj.LoadObjFile(filename);
}
if (ext.Equals(".3ds"))
{
ret = obj.Load3ds(filename);
}
if (ret == true)
{
m_engine3d.AddObject(obj);
SelectedObject = obj;
UVDLPApp.Instance().m_engine3d.UpdateLists();
m_slicefile = null; // the slice file is not longer current
RaiseAppEvent(eAppEvent.eModelAdded, "Model Loaded " + filename);
//now try to load the gcode file
String gcodefile = Path.GetFileNameWithoutExtension(filename) + ".gcode";
String gcodepath = SliceFile.GetSliceFilePath(filename);
String gpath = gcodepath + UVDLPApp.m_pathsep + gcodefile;
if (File.Exists(gpath))
{
LoadGCode(gpath);
}
else // read the gcode from the zip file
{
String zpath = gcodepath + ".zip";
if(File.Exists(zpath)) // make sure the file exists before we try to read it
{
Stream s = Utility.ReadFromZip(zpath, gcodefile);
if(s != null)
{
s.Seek(0, 0); // go to the beginning of the stream
byte []array = Utility.ReadFully(s);
string gc = System.Text.Encoding.ASCII.GetString(array);
m_gcode = new GCodeFile(gc);
RaiseAppEvent(eAppEvent.eGCodeLoaded, "GCode Loaded " + gcodefile);
}
else
{
DebugLogger.Instance().LogError("Could not load GCode from Zip " + zpath);
}
}
}
if(m_gcode !=null)
{
int xres, yres, numslices;
xres = m_gcode.GetVar("Projector X Res");
yres = m_gcode.GetVar("Projector Y Res");
numslices = m_gcode.GetVar("Number of Slices");
m_slicefile = new SliceFile(xres,yres,numslices);
m_slicefile.modelname = obj.m_fullname;
m_slicefile.m_config = null; //this can be null if we're loading it...
RaiseAppEvent(eAppEvent.eSlicedLoaded, "SliceFile Created");
}
}
else
{
RaiseAppEvent(eAppEvent.eModelNotLoaded, "Model " + filename + " Failed to load");
}
return ret;
}
catch (Exception ex)
{
DebugLogger.Instance().LogRecord(ex.Message);
return false;
}
}