@Helvetosaur wrote:
Looks like a method got incorrectly named…
Rhino.Geometry.Curve.LcoalClosestPoint Method
Don’t know how many scripts/grasshopper components are already dependent on this one…
Posts: 1
Participants: 1
@Helvetosaur wrote:
Looks like a method got incorrectly named…
Rhino.Geometry.Curve.LcoalClosestPoint Method
Don’t know how many scripts/grasshopper components are already dependent on this one…
Posts: 1
Participants: 1
@SpunkyDeadcat wrote:
UserDictionary.Set( string key, Plane val);
sets a PlaneI don’t see a Method GetPlane(string, Plane)
How would retrieve that value?
Posts: 1
Participants: 1
@kitjmv wrote:
Hello !
I would like to know if it is possible to switch between GetPoint and GetObject when executing a command.
For example : I have a command for draw a box. I would like run the command then pick a point or press special key for selecting a vertex corner.
Thank you,
Posts: 1
Participants: 1
@D-W wrote:
As in the topic - i want to prevent deleting blocks which were created by my plugin on purge command is there any way for doing this?
I mean of course i can listen to commands and take action like:
Command_BeginCommand / Command_EndCommand
to add those to doc and then delete them ( can’t just re-add them after purge cause guids will change ) but maybe there other better way to handle this discreetly?
Posts: 4
Participants: 2
@kitjmv wrote:
Hello,
I can see in the source file that
ON::object_type
(C ++) andRhino.DocObjects.ObjectType
(.Net) is just a direct integer conversion.so I set the
ON::object_type.brepvertex_filter
value toGetObject.GeometryFilter
:var go = new GetObject (); go.SetCommandPrompt ("Select"); go.GeometryFilter = (ObjectType) 0x100000; go.GetMultiple (0, 0);
And this works !
If
GetObject.GeometryFilter
is just a wrapper around the c function, whyRhino.DocObjects.ObjectType
can not set a BrepVextex ?And I have another question.
In .Net, I can not select extrusion vertices withGetObject
.
How can we do that?Thank you
Posts: 2
Participants: 1
@kyxiang1 wrote:
I want to simulate the carving with a chisel. So I wrote this below. But I think there must be a better way to get it. Thanks!
import rhinoscriptsyntax as rs
#Create a function for carving with rectangle.
def trianglecarving():
#Create a sketch curve on a surf.
commandsketch = “_Sketch”
curve = rs.Command(commandsketch, False)
if not curve: return
new_curve01 = rs.LastCreatedObjects(select=True)#Create a triangle surrounding the curve.
#Creat the plane for the rectangle
if new_curve01:
plane = rs.CurvePerpFrame(new_curve01[0], 0)
#Creat the triangle
rectangle01 = rs.AddRectangle( plane, 3.0, 0.5)
if rectangle01:
#Mirror the rectangle and then create the rectangle
plane1 = rs.ViewCPlane()
xform = rs.XformMirror(plane1.Origin, plane1.Normal)
rectangle02 = rs.TransformObjects(rectangle01, xform, True )
if rectangle02:
explodedCurves = rs.ExplodeCurves([rectangle02], True)
curve0 = rs.FirstObject()
curve1 = rs.NextObject(curve0)
curve2 = rs.NextObject(curve1)
curve3 = rs.NextObject(curve2)
pointstart = rs.CurveStartPoint(curve3)
pointend = rs.CurveEndPoint(curve3)
point01 = rs.AddPoint(pointstart)
point02 = rs.AddPoint(pointend)
midpoint = rs.CurveMidPoint(curve1)
point03 = rs.AddPoint(midpoint)
trianglepolyline = rs.AddPolyline([point01,point02,point03,point01])
if trianglepolyline:
surface = rs.AddPlanarSrf(trianglepolyline)
#Extrude the triangle prism
triangleprism = rs.ExtrudeSurface(surface, new_curve01)
if triangleprism:
rs.DeleteObjects([rectangle01,trianglepolyline,new_curve01,surface,curve0,curve1,curve2,curve3,point01,point02,point03])
#Boolean the box
input0 = rs.LastObject()
input1 = rs.FirstObject()
rs.BooleanDifference(input0, input1)if( name == “main” ):
trianglecarving-L3W1.py (2.0 KB)
#Call the function
trianglecarving()
Posts: 1
Participants: 1
@pagarcia wrote:
Hello,
In Rhino 5, when clicking on the
Show isocurve
flag in Zebra analysis for an object, the C++ SDK corresponding flag used to bedp.DrawingWires()
inside
void CRhinoObject::Draw(CRhinoDisplayPipeline& dp) const;
In Rhino 6 for some reason it’s no longer like this, looks like
dp.DrawingWires()
is always set to true. Is this a glitch or I’m going for the wrong flag?Thanks,
Pablo
Posts: 1
Participants: 1
@kitjmv wrote:
Hello,
Usually we have the answer in the day or the next day.
Sory for my question, but i see this cathegory is very inactive.Maybe McNeel’s people went to a seminar or maybe there is another place to ask a development question with RhinoCommon?
Thank you.
Posts: 3
Participants: 2
@Petras_Vestartas wrote:
Hi,
I am wrapping some native C++ library variables to C#.
Before I had one C# component where I had everything working fine calling CLI wrapped variables and solver. But now I want to distribute my code into multiple components.The thing is that I disposed some variables by placing them into brackets so that jointElementMatsSet and ele_link_tnl2 are deleted. I could also call Dispose method.
The small bit of code is here:{ var jointElementMatsSet = new OpenSees.Materials.Uniaxials.UniaxialMaterialWrapper[] { Axial_perimeter_long_leftMat, Shear_1_perimeter_long_leftMat, rigidmattagMat, FreemattagMat, FreemattagMat, FreemattagMat }; var ele_link_tnl2 = new OpenSees.Elements.TwoNodeLinkWrapper(2, 3, 16, 1601, dirIds2, jointElementMatsSet, new OpenSees.VectorWrapper(new double[] { 1, 0, 0 }), new OpenSees.VectorWrapper(new double[] { 0, 0, 1 }), new OpenSees.VectorWrapper(0), new OpenSees.VectorWrapper(0), 0, 0); theDomain.AddElement(ele_link_tnl2); }
But now since I want to distribute different classes into different components I have a question:
Can I create one variable in one component and dispose it in another one?
More simply: when two components are connected and second component receives the variable, is it duplicated or it points to the same memory location?
Posts: 1
Participants: 1
@binigya wrote:
Hey, I’m a new user and I followed the following steps to set up VS with openNURBS:
a) https://developer.rhino3d.com/guides/opennurbs/getting-started/
b) https://developer.rhino3d.com/guides/opennurbs/linking-with-opennurbs/But, I’m getting an error that "Error LNK1104 cannot open file ‘zlib_d.lib’ ".
What am I doing wrong and how should I go on about to fix this? Thanks!
Posts: 3
Participants: 2
@dks5254 wrote:
I am trying to write a class for a custom curve object that also includes custom drawing. At this phase I am still testing around and trying to become familiar with writing plugins in c++. However, it appears that the override for the draw function suddenly stops working as soon as I modify the grips for the associated curve. Can anyone explain why and how to fix this? Here is the code:
#include "stdafx.h" #include "planCurve.h" #include "rhinoSdkDraw.h" ON_OBJECT_IMPLEMENT(planCurve,CRhinoCurveObject, "A0590105-4EE2-4924-A1BC-88554592C6D4") planCurve::planCurve() { this->EnableGrips(true); } void planCurve::Draw(CRhinoDisplayPipeline& dc) const { ON_Color color = ON_Color(100, 100, 200); const ON_Curve* crv = this->Curve(); dc.DrawCurve(*crv, color, 5,NULL); } void planCurve::DrawHighlightedSubObjects(CRhinoDisplayPipeline& dc) const { } planCurve::planCurve(const planCurve& src) : CRhinoCurveObject(src) { } planCurve& planCurve::operator=(const planCurve& src) { if (&src != this) { CRhinoCurveObject::operator=(src); } return *this; } ON_Curve* planCurve::SetCurve(const ON_NurbsCurve& curve) { return CRhinoCurveObject::SetCurve(curve); } void planCurve::SetCurve(ON_NurbsCurve* pCurve) { CRhinoCurveObject::SetCurve(pCurve); } planCurve::~planCurve() { }
Posts: 1
Participants: 1
@Petras_Vestartas wrote:
I am using generic input parameter for Grasshopper input which is by default Gh_objectwrapper.
How can I cast retrieved input to my type which is I. E. called UniaxialMaterial?
When I try to write:
UniaxialMaterial mat = (UniaxialMaterial) uniaxial.This casting produces an error that says it cannot convert gh_objectwrapper to UniaxialMaterial.
Posts: 2
Participants: 2
@kitjmv wrote:
Hello,
I can not get Function PickObjects to work.
I checked the arguments, everything is fine.The
GetFrustumLine
signature is :
public bool GetFrustumLine (double screenX, double screenY, out Line worldLine);
but in the example https://wiki.mcneel.com/developer/rhinocommonsamples/gumball,screenX
andscreenX
are set with a client point (GetPointMouseEventArgs.WindowPoint
)Can you confirm me that the
GetFrustumLine
take a screen coordinates ?Does the PickObjects function work for you ?
my code:
class Helper { public static int PickObjects (Rhino.RhinoDoc doc, RhinoView view, System.Drawing.Point clientPoint, ref ObjRef[] Objects) { if( view == null ) return 0; var vp = view.ActiveViewport; PickContext ctx = new PickContext (); ctx.View = view; ctx.PickStyle = PickStyle.PointPick; ctx.PickMode = PickMode.Shaded; var xform = vp.GetPickTransform (clientPoint); if( xform == null ) return 0; ctx.SetPickTransform (xform); var screenPoint = vp.ClientToScreen (clientPoint); vp.GetFrustumLine (screenPoint.X, screenPoint.Y, out Line ln); ctx.PickLine = ln; ctx.SubObjectSelectionEnabled = true; ctx.UpdateClippingPlanes (); Objects = doc.Objects.PickObjects (ctx); return Objects.Length; } }
Thank you.
Posts: 1
Participants: 1
@Mat_S wrote:
I am using the rayshoot method in python on windows. After some iterations, rhino crashes.
Essentially when the code runs through a certain number of iterations it crashes. Less than this limit it works as expected. It is not running out of RAM, since I can monitor the usage and it sits around 270mb (computer has 128gb). It is not hitting an array limit (its a dict of around 900 key/value), and I checked rhino python interpreter is returning an error if it exceeds the limit (during my debugging).
When the code runs more iterations than it can (which is about 2 seconds of computation time, then on higher iteration takes 10 seconds ) and crashes, rhino just shuts off completely. There is no freezing, hanging, or windows error message, it just closes and thats it. Is there a log or way to figure out the traceback on what caused Rhino to shut off?
Posts: 1
Participants: 1
@nathancoatney wrote:
This is probably a long-shot, but I’m hoping someone here may have some advice or workaround.
I have a rhinopython script that opens a modeless eto window and a socket server on another thread. Control and communication are via two Queue.Queue(). The general idea is the window is just for display/feedback and stopping the server/script when user wants to. External programs connect a socket to the server and send messages.
Everything works fine on the first run of the script, on a fresh start of Rhino. If I stop the script, everything seems to shut down correctly…no errors or exceptions that can see. However, upon second start of the script, no clients can connect to the server.
I have tried 2 approaches for the socketry:
Using non-blocking socket.socket()
Using SocketServer.TCPServer()
results in multiple listening handles holding the socket, according to netstat -ano|findstring
results in [Errno 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted, since I can’t seem to get the reuse option set to true.
Method 2 is more overhead than I want, and isn’t solving anything for me.
Charging on with method 1, I duplicated the code as much as possible in cpython and observe with netstat that the listening handle does not linger as it is in rhino. Curiously, I also observe if I wait long enough, the listening handles from rhino.exe will disappear on their own, and clients can then connect after I start the script again.
I have taken great care to .close() all client connections after receiving data, as well as the serving socket, upon exiting of the eto window (on_form_close event). The thread is join()ed after socket is closed.
I have a feeling that the lingering listening handle exists because Rhino.exe (that is the PID associated) is still running. The only other thing I can think to try is to use .net socket/thread instead of the ironpython implementations, but haven’t been able to google up any information that may suggest that will change anything.
I can send some minimal code if anyone would like to take a look.
Thanks.
Posts: 3
Participants: 2
@dks5254 wrote:
I am working on a Python project using rhinocommon and have stumbled on some questions. Is it possible to store an array of geometryBase objects such as curves in the UserDictionary of another object? I see that one option is Set(String, IEnumerable<Guid>) which I have tried doing. Originally I tried simply:
branch[i][0].UserDictionary.Set("Stored",curves)
Which gave me an error “Multiple targets could match: Set(str, IEnumerable[ObjRef]), Set(str, bool), Set(str, IEnumerable[Guid]), …”. So I tried the following:
branch[i][0].UserDictionary.Set.Overloads[str,IEnumerable[Guid]]("Stored",curves)
However now I am receiving an error “MakeGenericType on non-generic type”. And even if I get this to work I would prefer if these curves lived only in the memory and not as a manipulable object in the document.
TL:DR: How can I store a list of curves in another objects UserDictionary? If not possible, how do I at least store a list of Guids in another objects UserDictionary?
EDIT: Solved the user dictionary of Guid (was importing System.Collections.IEnumerable as IEnumerable instead of System.Collections.Generic.IEnumerable as IEnumerable (used in “.Overloads[…”). This is fine, and I am just locking and hiding the curve objects before adding their Guids to the dictionary, however hideSwap causes them to appear still, and I am looking for these objects to not be possible to interact with in any way so this is still not ideal. However found another post about converting to byte array and and then storing strings that way, is that possible for curve objects potentially as well?
Posts: 2
Participants: 1
@sghosh wrote:
Hi All,
I am trying to test out C++ SampleUI example. It compiled successfully. Then I created a separate project and made some changes to it now while compiling I get the following error :
--- Rhino C++ component links with libs in "C:/Program Files/Rhino 6 SDK/Lib/Release"
1>cmdTestUI.cpp
1>TestDialogScrollHelper.cpp
1>TestRhinoDockbar.cpp
1>c:\program files\rhino 6 sdk\inc\rhinosdkuidockbar.h(463): error C4430: missing type specifier - int
assumed. Note: C++ does not support default-int
1>c:\program files\rhino 6 sdk\inc\rhinosdkuidockbar.h(463): error C2143: syntax error: missing ',' before '&'
1>c:\program files\rhino 6 sdk\inc\rhinosdkuidockbar.h(521): error C3646: 'm_close_button': unknown override specifier
1>c:\program files\rhino 6 sdk\inc\rhinosdkuidockbar.h(521): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\rhino 6 sdk\inc\rhinosdkuidockbar.h(522): error C3646: 'm_gear_button': unknown override specifier
1>c:\program files\rhino 6 sdk\inc\rhinosdkuidockbar.h(522): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>TestRhinoDockbarDialog.cpp
1>TestUIApp.cpp
1>TestUIPlugIn.cpp
1>Generating Code...
1>Done building project "TestUI.vcxproj" -- FAILED.
I don’t think it is a problem of sdk. Please find attached the source code. Any help would be much appreciated.
Posts: 1
Participants: 1
@samlochner wrote:
Say I create a point and add it to the doc as follows:
Dim CenterPoint = new point3d(10,10,10)
Dim CenterPointID = doc.objects.addpoint(CenterPoint)Now that the point is in the doc, is there any way for me to figure out figure out what the original name of the point’s variable was (CenterPoint). I’m asking because I am adding a huge number of objects to the doc and I haven’t set the attributes to reflect their name. And I’m trying to figure out which is which.
I’m picturing a function where, from within Rhino, I pick the object in question, and somehow I’m alerted to what the original name of it’s variable was (should be CenterPoint).
Suggestions?
Thanks,
Sam
Posts: 1
Participants: 1
@Ambrosinus wrote:
I wondering if it is possible to code something like my GH def by Eto library (req.: radio button, text box and web browser frame). Thanks in advance!
below
Find Rhino Commands Name
a simple trick to switch commands name to different languages. Effective solution but not very “elegant” - does its duty
Find Rhino Commands Name VIDEO
Posts: 1
Participants: 1
@DanBayn wrote:
Is it possible to import named views via a Python script? I have a set of named views in a default template, but I’d like to be able to import those views along with the default template. From what I can see now, the views do not import with the template.
Thanks,
Dan
Posts: 3
Participants: 2