both my plotter/cutter and wide format printer. I had been running the plotter from my main work laptop - a Win10 machine via the plotters USB port. As it turns out you can't get Win XP drivers for this USB connection so I needed another solution.
I tried to use the plotters DB25 serial port connection using an old DB9 to DB25 modem cable I had in my collection = no luck the plotter wouldn't talk. A bit more research and it turns out these plotters need a 'null modem' cross over cable to operate. I found a pic of the correct wiring online and made up my own with some cable and connectors from the local electronics hobby shop.
With this hooked up and using Hyperterminal I was able to fire some codes to the plotter directly and get a response back - winning!
At this point I got my original code working with the 'net use' redirect from LPT1 to COM1.
HOWEVER - being that the plotter was now on a COM port there are a few more interesting things you can do with it - one is being able to read the paper size/cut area from the printer.
So what I needed to to was find a way to send and receive data to/from the plotter using the serial port.
A bit of research into .NET's serial port interface and using a bunch of small pieces of test code I have manged to completely re-jig this driver.
Upgrades include:
- Direct Serial Port comms using Null Modem cable (a USB to serial adaptor + null modem should also work)
- Plot area read from the plotter - a rectangle the size of the plot area is placed on a separate layer and coloured red
- Testing to see if selected plotting curves are both closed and inside of the cutting area - with errors shown and exiting if they are not right.
- After plot 'parking' of the plot head at the end of the cut items + an adjustable offset (currently requires manual resetting of origin on the plotter before for next cut)
Great thing is it is now 100% running within Rhino Python - no DOS command line calls = no flashing up of the CMD wind. Also no temp files needed on the HDD and no limit to number of curves that can be plotted - tested with 200 or so with no issues.
Overall very happy with whole project - have learnt a LOT about Python and .NET interfacing AND ended up with a very handy/useful tool.
Cheers
DK
# This code is a WIP # It plots directly to a DGI Plotter# via the serial port
import System.IO.Ports as Portsimport rhinoscriptsyntax as rsimport time
#Some setup valuescom_port = 'COM1' #change to match plotter port baud_rate = 9600 #change to match plotter settingplotter_step = .025 #mmfinsh_offset = 10 #mm
#Delete old cutting area and cut objectsif rs.IsLayer('Cutting Area'): rs.PurgeLayer('Cutting Area')if rs.IsLayer('Cutting Objects'): rs.PurgeLayer('Cut Objects')
#Setup Serial PortMyport = Ports.SerialPort(com_port)Port_Write = Ports.SerialPort.WriteMyport.BaudRate = baud_rateMyport.ReadTimeout=5000 #5 secsMyport.Close()Myport.Open()
#Setup PlotterPort_Write(Myport, 'PU;PA0,0;IN;\n')Port_Write(Myport, 'SP1;\n')Port_Write(Myport, 'PA;\n')time.sleep(2)
#Read the Paper size from PlotterPort_Write(Myport, 'OH;') #HPGL read limits codetime.sleep(2)
return1 = ''papersize = ''count = 0char_in_buffer = 0chars_in_buffer = Ports.SerialPort.BytesToRead.GetValue(Myport)
if chars_in_buffer == 0: print 'Plotter not ready' Myport.Close() exit()
while (count < chars_in_buffer): return1 = Myport.ReadChar() papersize = papersize + chr(return1) count = count + 1
papersize = papersize.split(",")rect1 = (float(papersize[2])*plotter_step)rect2 = (float(papersize[3])*plotter_step)
print 'Cutting area = ' + str(rect1) + 'x' + str(rect2)
#place cutting area curve on its own layer, make it red and lock itplane = rs.WorldXYPlane()cutting_area = rs.AddRectangle( plane, (rect1), (rect2))rs.AddLayer (name='Cutting Area', color=(255,0,0), visible=True, locked=True, parent=None)rs.ObjectLayer(cutting_area, 'Cutting Area')
#get plotting objects
allCurves = rs.GetObjects("Select curves to plot", rs.filter.curve)
#test to see if these are closed curves - exit if not
for curve in allCurves: test_closed = rs.IsCurveClosed(curve) if test_closed == 0: print "One or move of these curves are not closed" Myport.Close() exit()
#test to see if these are inside cutting area - exit if not
for curve in allCurves: test_inside = rs.PlanarClosedCurveContainment(curve, cutting_area)
if test_inside==0 or test_inside==1: print "One or more of these curves are outside of cut area" Myport.Close() exit()
#All ok - convert to points and send data to printer
rs.AddLayer (name='Cut Objects', color=(0,255,0), visible=False, locked=True, parent=None)
for curve in allCurves: Port_Write(Myport, 'PU;PA;SP1;\n') polyline = rs.ConvertCurveToPolyline(curve,angle_tolerance=5.0, tolerance=0.025, delete_input=False, min_edge_length=0, max_edge_length=0) points = rs.CurveEditPoints(polyline) rs.ObjectLayer(polyline, 'Cut Objects')
# PU to the first point x = points[0][0] y = points[0][1] Port_Write(Myport, 'PU' + str(int(x / plotter_step)) + ',' + str(int(y / plotter_step)) + ';\n') # PD to every subsequent point i = 1 while i < len(points): x = points[i][0] y = points[i][1] Port_Write(Myport, 'PD' + str(int(x / plotter_step)) + ',' + str(int(y / plotter_step)) + ';\n') i += 1
Port_Write(Myport,'PU;\n')
#find the far end of the cutbox = rs.BoundingBox(allCurves)far_end = str(box[1])far_end = far_end.split(",")far_end = far_end[0]far_end = float(far_end)/plotter_stepfar_end = (int(far_end))+ finsh_offsetfar_end = str(far_end)print (far_end)
#return plotter home and close portPort_Write(Myport, 'PU;PA' + far_end + ',0;IN;\n')Port_Write(Myport, 'SP1;\n')Port_Write(Myport, 'PA;\n')Myport.Close()time.sleep(10)…
ed to develop a component that reads data from a Tracking Server we have built here in our lab, on top of VRPN Server. We developed a client library to communicate with this server and to read data from different devices through the server, making our life easier. The fact is that I need to update data received from a wiimote for example (at a regular time interval) and output this data to feed other components. Our first approach was to test the inclussion of that library into the context of Grasshopper and it worked, but just and only for the first time the component is created of course. Now the problem is to call this update function inside grasshopper multiple times and update the output. I'm new to grasshopper component coding so, it would be nice if I can get some response of an expereinced developer or at least somebody that have developed something like the example I'm exposing here. Some code is posted below to clarify what I'm saying.
...
using VRPNClassLib; //This is our class lib.namespace MyComp{ public class MyComp : GH_Component { private VRPNController controllerWiimote = new VRPNClassLib.VRPNController("WiiMote0@localhost"); private Wiimote wii = new Wiimote();
...
private double rotX, rotY, rotZ; public MyComp() : base("Al required params ok") { try { controllerWiimote.addDevice(wii); } catch (Exception e) { throw new Exception("No wii controller attached to the PC: -->" + e.Message); } }
...
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) { pManager.Register_DoubleParam("Pos X", "X", "Wiimote X"); pManager.Register_DoubleParam("Pos Y", "Y", "Wiimote Y"); pManager.Register_DoubleParam("Pos Z", "Z", "Wiimote Z"); } protected override void SolveInstance(IGH_DataAccess DA) {
// If execute MainLoop() here for the first time it works of course, but I need to continuously read data from wiimote, how do I do that
MainLoop(); DA.SetData(0,rotX); DA.SetData(1,rotY); DA.SetData(2,rotZ); }
protected void MainLoop() { controllerWiimote.UpdateData(); //this is the function that updates device data rotX = Math.Round(wii.getSensorRot1(),2); rotY = Math.Round(wii.getSensorRot2(),2); rotZ = Math.Round(wii.getSensorRot3(),2); }
public override Guid ComponentGuid { //Genere el GUID del componente get { return new Guid("8F9858D8-F18E-45f2-90EC-CC23523ACC4F"); } } ... }}
So any sugestions are welcome.
Cheers :)…
I am not knowledgeable about google maps nor google maps api, but from what I read the two components will definitely show a bit different results due to different topography sources.If it is judging by this 2010 article, your Terrain Generator component offers much higher precisions for USA. Precision goes up to a couple of meters, which is amazing!!On the global scale it offers either SRTM 1 or 3 arc-second data or 30 arc-second GLOBE data. Again this is from the mentioned article, I couldn't find this information by searching the Google Maps website.Terrain Generator 2 component always uses SRTM 1 arc-second data from opentopography.org, and it is limited to 60 degrees north and does not have data for Antarctica. It does not come with satellite image either which is another very convenient feature that you have!I couldn't find information about the allowed radius provided by the Google maps api free account. I limited the "radius_" input to 100 000 meters, even though opentopography.org provides more than that (I successfully downloaded 300 000, but Rhino 5 was not able to create a topography on my PC from such a large amount of data).Even though I couldn't compare the results from two components, by looking at your upper example_LB_terrain_generator.gh definition: set the "I" input of "Surface from points" component to True. In this way the surface will be interpolated through points, which is what we want.
Again thank you for the permission, and I look forward seeing those high precision topography that Google maps offers!!…
Python est un langage reconnu pour sa puissance, clarté et compréhension.
Durée : 2 jours soient 16 heures
Public concerné
Utilisateurs de Rhinoceros
Objectifs de la formation :
Donner aux utilisateurs la possibilité d'accéder à la fois aux bibliothèques RhinoScript, des bibliothèques de fonctions très simples d'utilisation. Et permet aussi d'accéder à Rhinocommon la collection de fonctions permettant de réaliser des plug ins (greffons).
Les moyens pédagogiques :
La formation utilise le RhinoPython Primer comme support.
Venir avec un PC Portable avec Rhinoceros 5,0 et éventuellement Grasshopper.…
pper" in the command line in Rhino:
"Unable to load Grasshopper.dll plug-in: Rhino version not specified."
Details of the command line are as follows:
Command: GrasshopperRhino.NET plug-in: C:\Program Files\Rhinoceros 4.0\Plug-ins\Grasshopper\Grasshopper.dll> - referenced assembly count: 20> - mscorlib> - Microsoft.VisualBasic> - System.Windows.Forms> - GH_IO> - System.Drawing> - System> - RhinoCommon> - GH_Util> - OpenTK.GLControl> - QWhale.Editor> - QWhale.Syntax> - QWhale.Syntax.Parsers> - System.Core> - System.Design> - System.Xml> - System.Data> - OpenTK> - QWhale.Common> - System.Xml.Linq> - System.ServiceModel> Rhino.NET error: unable to locate a reference to Rhino_DotNET.DLL> Unable to load Grasshopper.dll plug-in: Rhino version not specified.
I tried creating the new user and looks like that one works too, but I do need my current "user" profile as there are a lot of things already set up well, do not want to miss those.
If someone could advise me on where to look for the problem?
Thank you,
Artem
…
surface which are fully inside it(each cell's area should be 100% inside surface).
Idea how to do this:
Use Surface|Curve to cut the grid of cells to the surface --->
---> Area to get centroids of those cells --->
---> Dispatch using as pattern distances of cells' centroids from polyline to have in one of list those that are fully within the surface --->
---> Dispatch using as pattern distances of cells' centroids from curves (that defy holes) to have in one of list those that are fully within the surface
Problem:
Cannot use Area to extract centroids. Ironically, when I click on the Area button is shows me centroids of all of cells that are fully inside surface but button is red so I cannot progress.
I tried using Split Surface too (instead of Surface|Curve) but it crashed my PC, even after flattening input data.
I'm a newbie and looked for answer but did not manage to find topic that would relate to my problem. Maybe I formulate my questions in wrong way.
…
supplied _values of _keys" notice.I tried running the "OSM 3D" component first with groundTerrain_ input. As I did not get the upper notice message, I closed down the whole Rhino so that I cut the waiting time. Then I tried running it without the groundTerrain_ input, and in some 15 minutes I got the following buildings:
I think I may understand what was causing the problem: when one takes large radii, it covers large areas, and with this area comes large number of information (keys and values). You can get hundreds of keys (or thousands). What can happen is that: these hundreds of keys, can exceed shapefile's capacity to story keys. So basically in case of radius 750 meters your "height" or "buildings:levels" keys somehow slipped beyond this allowable capacity. In case of 800 meters they were somehow allowed to enter (a bit bad term sorry) before the allowable capacity is reached. This depends on the number of keys named with letters which precede the "h" and "b".The best way to solve this issue is to know which data do you actually need, and use the "OSM Keys" component to generate the list of needed keys. In this way, only those keys that you need will be used, others will be disregarded.You do not even have to use the "OSM Keys" component if you know which specific keys you exactly need. Check the attached file below. I grouped the "OSM Keys" solution as "a" and a custom defined list of keys as "b".
2) The component running time might now be cut with picked "requiredKeys_" input I mentioned at the end the previous 1) part.
3) "OSM 3D" component's "randomHeightRange_" input is suppose to do exactly that: to randomly create 3d buildings (or 3d trees) when there are no valid "height" or "buildings:levels" tags.I have just changed one line the "OSM shapes" component code.I wonder if it would make any problem on your PC.Please let me know if LocationGrabber03_Gismo2.gh file works.…
Added by djordje to Gismo at 2:34pm on February 11, 2017
o está dirigido a estudiantes de arquitectura y diseño de interiores, recién titulados y profesionales interesados en el software o que necesiten conocer las herramientas básicas de las que dispone el programa en los diferentes ámbitos y cómo enfocarlas a arquitectura.
Descripción:El contenido del curso enseñará a utilizar el programa de diseño Rhinoceros 3D aplicando su metodología de trabajo en el campo de la arquitectura, básandose además de la creación de pequeños elementos paramétricos para controlar el diseño y acabar renderizando las geometrías 3d con V-Ray para Rhino.
El curso consta de 3 módulos de 12h de duración cada uno (que pueden realizarse juntos o por separado) en los cuales se profundizará en herramientas de Rhino, Grasshopper y V-Ray a medida que se realizan casos prácticos sobre proyectos arquitectónicos.Se pretende establecer un sistema de trabajo eficiente desde el inicio del modelado hasta la posterior creación de imágenes para documentación del proyecto.
Módulo Rhinoceros Arquitectura:• Conceptos básicos e interfaz de usuario Rhino• Introducción al sistema cartesiano en Rhino• Clases de complejidad de geometría• Importación/exportación de archivos compatibles• Topología NURBS• Trabajo con Sólidos• Estrategias básicas de Superficies• Introducción a Superficies Avanzadas
Módulo Grasshopper:• Conceptos básicos e interfaz de usuario Grasshopper• Introducción a parámetros base y componentes• Matemáticas y trigonometría como herramientas de diseño• Matemáticas aplicadas a creación de Geometría• Introducción a listas simples• Análisis de Superficies y Curvas• Dominios de Superficies y Curvas• Panelado de superficies• Manejo de listas y componentes relacionados• Modificación de panelados en función de atractores• Exportación/Importación de información a Grasshopper
Módulo V-Ray para Rhinoceros:• Conceptos básicos e interfaz de usuario V-Ray• Vistas guardadas• Materiales V-Ray• Materiales, creación y edición• Iluminación (Global Illumination, Sunlight, Lights)• Cámara Física vs Cámara default• Canales de Render• Postprocesado básico de canales
Detalles:Instructores: Alba Armengol Gasull y Oriol Carrasco (SMD Arquitectes)Idioma: CastellanoHorario: 22 JULIO al 26 JULIO 2013 // 10.00 – 14.00 / 16.00 – 20.00Organizadores: SMDLugar: SMD lab, c/Lepant 242 Local 11, 08013 Barcelona (map)
Software:Rhinoceros 5Grasshopper 0.9.00.56V-Ray 1.5 for RhinoAdobe Photoshop CS5Links de versiones de evaluación de los Softwares serán facilitadas a todos los asistentes. Se usará unica y exclusivamente la versión de Rhino para PC. Se ruega a los participantes traer su propio ordenador portátil.
Registro:Modalidad de precio reducido por tres módulos 275€Posibilidad de realizar módulos por separado 99€…
of the point cloud. It is super quick, compared to what you have seen so far in Rhino, to load and display point clouds, as it works on multiple threads. Amongst others you can section the point cloud for referencing your footbridge, decimate it as needed for creating the enviroment, denoise it, clip and save parts of point clouds etc. You can right click the cloud components, giving you access to dynamic preview of the cloud, so that it does not drag in viewport while panning and zooming and at the same time controlling the "thickness" of the points in viewport, in case your camera gets close to the point cloud. It is a matter of visual preference.
I think that even 200mil points can be loaded with volvox.
Some references
12million points
13million points
13million points (right click dynamic settings low thickness)
13million points (right click dynamic settings high thickness)
15 million points (around 20sec!! to l0ad)
My pc (i7 3820, 32gb ram, gtx670 4gb) felt comfortable working with up to 15 mil point clouds. But that has to do with hardware along with your patience while working.
All clouds have been loaded as .txt files where the mask describing the info was x,y,z,r,g,b,u,v,w. Depends on how your data is in-text formatted.
You can check fly through animations all done with gh and Volvox here
(starting @~2:20)
best
alex
…
it seems that was this. Now all is working fine !
Glad that it worked! But I am still a bit worried. Gismo components only modify the gdal-data/osmconf.ini file and no other MapWinGIS file. So your MapWinGIS installation files should not be compromised. The fact that you did not get the "COM CLSID" error message when running the "Gismo Gismo" component suggests that MapWinGIS has been properly installed. So I wonder if the cause for the permanent "invalid shapes" warning has again something with the fact that your system is again not allowing the MapWinGIS to properly edit the osmconf.ini. Maybe this problem will appear again, and again, and reinstallation of MapWinGIS every time can be somewhat bothersome.
- About the terrain generation, is it possible to have the texture from google or other provider mapped onto the terrain surface from gismo component ? (Same as using the ladybug terrain generator in fact). I try to used the image extracted by ladybug component and then applied it to the gismo terrain but the texture is rotated by 90°.
The issue with the rotation can be solved by swapping/reversing the U,V directions of the terrain surface. A slightly more important issue is that terrain surface generated with Gismo "Terrain Generator" component might have a bit smaller radius than what the radius_ input required. This stems from the fact that the terrain data first needs to be downloaded in geographic coordinate system, and then projected. Some projecting issues may occur at the very edges of the projected terrain, so I had to slightly cut out the very edges of the terrain which results in the actual terrain diameters being slightly shorted in both directions. This means that if you apply the same satellite image from Ladybug "Terrain Generator" component to Gismo "Terrain Generator" component the results may not be the same.I attached below a python component which tries to solve this issue by extending the edges of Gismo "Terrain Generator" terrain, and then cutting them with the cuboid of the exact dimensions as the radius_ input. Have in mind that this extension of the original terrain at its edges is not a correct representation of the actual terrain in that location. But rather just an extension of the isoparameteric curve of the terrain surface. So basically: some 0 to 10% (0 to 10 percent of the width and length) of the terrain around all four edges is not the actual terrain for that location, but rather just its extension.The python component is located at the very right of the definition attached below.
Also, if you would like to use the satellite images from Ladybug "Terrain Generator" component along with "OSM shapes", sometimes you may find slight differences in position of the shapes. This is due to openstreetmap data not being based on Google Maps (that's what Ladybug "Terrain Generator" component is using), but rather on Bing, MapQuest and a few others.
- About the requiredKeys_ input of OSM shapes, I understand what you mean and your advice, but in most cases I use it, the component was working fine even without input. I think it's better to extract all tags, values and keys of the selected area, instead of searching for specific ones as I try to find all data related to what I want after, isn't it ? To check what keys are present on the area also.
Ineed, you are correct.I though you were trying to only create a terrain, 3d buildings and maybe find some school or similar 3d building, for these two locations. The recommendation I mentioned previously is due to shapefiles having a limit (2044) to how many keys it can contain. This requires further testing of some big cities locations with maybe larger radii, which I haven't performed due to my poor PC configuration. But in theory, I imagine that it may happen that a downloaded .osm file may have more than 2044 keys. In that case shapefile will only record 2044 of them, and disregard the others. That was my point.But again 2044 is a lot of keys, and I haven't been checking much this in practice. For example, when I set the radius_ to 1000 meters, and use your "3 Rue de Bretonvilliers Paris" location I get around 350 something keys, which is way below the 2044.Another reason why one should use the requiredKeys_ input is to make the Gismo OSM components run quicker: for example, the upper mentioned 350 something keys will result in 350 values for each branch of the "OSM shapes" component's "values" output.Which means if you have 10 000 shapes, the "OSM shapes" component will have 10 000 branches with 350 items on each branch (values). This can make all Gismo OSM components very heavy, and significantly elongate the calculation process.With requiredKeys_ input you may end up with only a couple of tens of items per each branch.Sorry for the long reply.…
Added by djordje to Gismo at 8:57am on June 11, 2017