资源简介

Creation-Workshop 3d打印 dlp/sla3d打印切片软件 源码

资源截图

代码片段和文件信息

package org.area515.resinprinter.client;

import java.awt.Desktop;
import java.io.IOException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import javax.swing.JDialog;
import javax.swing.Jframe;
import javax.swing.JOptionPane;

import org.fourthline.cling.UpnpService;
import org.fourthline.cling.UpnpServiceImpl;
import org.fourthline.cling.model.message.header.STAllHeader;
import org.fourthline.cling.model.meta.Device;
import org.fourthline.cling.model.meta.RemoteDevice;

public class Main {
public static final String PRINTER_TYPE = “3DPrinterHost“;

private static Set foundDevices = new HashSet();
private static long maxLengthToWait = 5000;
private static long maxLengthToWaitForAll = 7000;

public static class PrintableDevice {
public Device device;

public PrintableDevice(Device device) {
this.device = device;
}

public String toString() {
return device.getDisplayString() + “ (“ + device.getDetails().getPresentationURI() + “)“;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((device == null) ? 0 : device.hashCode());
return result;
}

@Override
public boolean equals(object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PrintableDevice other = (PrintableDevice) obj;
if (device == null) {
if (other.device != null)
return false;
} else if (!device.equals(other.device))
return false;
return true;
}
}

/**
 * return 0 for printer found
 * returns -1 for user cancelled operation
 * returns -2 for error during operation
 * 
 * @param args
 */
public static void main(String[] args) {
JDialog searchPane = null;
final JOptionPane searchOptionPane = new JOptionPane(“Searching for all 3d printers on network...“ JOptionPane.INFORMATION_MESSAGE JOptionPane.CANCEL_OPTION null new String[]{“Cancel“} “Cancel“);

do {
final CountDownLatch waitForURLFound = new CountDownLatch(1);

Thread searchThread = new Thread(new Runnable() {
@Override
public void run() {
try {
UpnpService upnpService = new UpnpServiceImpl();
upnpService.getControlPoint().search(new STAllHeader());
long timeStarted = System.currentTimeMillis();
while ((foundDevices.size() > 0 && System.currentTimeMillis() - timeStarted < maxLengthToWait) ||
   (foundDevices.size() == 0 && System.currentTimeMillis() - timeStarted < maxLengthToWaitForAll)) {
if (searchOptionPane.getValue() != null && searchOptionPane.getValue().equals(“Cancel“)) {
System.exit(-1);
}

Collection devices = upnpService.getRegistry().getRemoteDevices();

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-12-09 23:31  Creation-Workshop-Host-master\
     文件         649  2015-12-09 23:31  Creation-Workshop-Host-master\LICENSE.md
     文件        5136  2015-12-09 23:31  Creation-Workshop-Host-master\README.md
     目录           0  2015-12-09 23:31  Creation-Workshop-Host-master\host\
     文件        3894  2015-12-09 23:31  Creation-Workshop-Host-master\host\.classpath
     文件          19  2015-12-09 23:31  Creation-Workshop-Host-master\host\.gitignore
     文件         380  2015-12-09 23:31  Creation-Workshop-Host-master\host\.project
     目录           0  2015-12-09 23:31  Creation-Workshop-Host-master\host\.settings\
     文件         598  2015-12-09 23:31  Creation-Workshop-Host-master\host\.settings\org.eclipse.jdt.core.prefs
     文件        3835  2015-12-09 23:31  Creation-Workshop-Host-master\host\BuildCWH.xml
     目录           0  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\
     文件          53  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\browseprinter.bat
     文件          68  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\browseprinter.sh
     文件         472  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\cwhservice
     文件          65  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\debug.sh
     文件          62  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\downgrade.sh
     文件          60  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\slicebrowser.bat
     文件          82  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\start.bat
     文件        5788  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\start.sh
     文件          59  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\startdev.sh
     文件          59  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\stop.sh
     文件          67  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\testKit.sh
     文件          70  2015-12-09 23:31  Creation-Workshop-Host-master\host\bin\testKitDev.sh
     文件          86  2015-12-09 23:31  Creation-Workshop-Host-master\host\build.number
     文件    23621045  2015-12-09 23:31  Creation-Workshop-Host-master\host\cwh-0.166.zip
     文件     2046532  2015-12-09 23:31  Creation-Workshop-Host-master\host\cwhClient-0.166.zip
     文件    23956775  2015-12-09 23:31  Creation-Workshop-Host-master\host\cwhTestKit-0.166.zip
     目录           0  2015-12-09 23:31  Creation-Workshop-Host-master\host\gui-prototypes\
     目录           0  2015-12-09 23:31  Creation-Workshop-Host-master\host\gui-prototypes\material-resin\
     文件        1100  2015-12-09 23:31  Creation-Workshop-Host-master\host\gui-prototypes\material-resin\LICENSE
     文件         525  2015-12-09 23:31  Creation-Workshop-Host-master\host\gui-prototypes\material-resin\README.md
............此处省略4799个文件信息

评论

共有 条评论