hello everyone, im very new to python programming and have my first issue
i made a plugin with python (works well in the rhino python editor and works well when i copy the py file in the python plugins folder). now i wanted to generate a plugin to distribute. i took the process through the rhino script compiler, everything works well, afterwards its installing the plugin, but when i start rhino, enter the plugin-command (the plugin name appears, i can click it) but after, nothing is happening.
Maybe you have an idea what it could be or maybe i totally forgot something?
check first under RhinoOptions / Plugins if your Plugin is properly listed and Loaded. Are all commands listed if you double click the plugin name in the plugin manager ? Did you compile rhp or as rhi file ?
the plugin should download texture from an free web texture database (by inserting the url from the chosen texture) and apply it on a surface in rhino. attached you find the rhi file and the raw python file
steps in rhino after installation:
01: commandname: mtextur
02: choose surface
03: insert url from mtextur
04: choose filename of texture which is being saved on C:\mtextur
Your script used the below line and seems to be a command script:
__commandname__ = "mtextur"
You do not need that to compile or to run.
Are you sure that if your plugin has the same command name, it will be used or will it use the name of the command script ? I would just remove the command script from rhino so there are no conflicts, or use a different command name / script name when compiling it. To make your script run, either from the python editor or a plugin, you have to uncomment this line of course:
RunCommand(True)
I´ve left the removed lines as comments. Try to compile this: mtextur.py (3.8 KB)
Hello @clement, thank you for all your explanations in this post.
I have the same issue as @MichaelW but I have not been able to resolve them. I have created this trial command which I call “hola2” in which I ask the user to provide a point thru the interface, and the the command adds it.
To create the plug-in, I’m using the RhinoScriotCompiler and I create the files a .rhp
However, once the Plug-in is created, I drag and drop it to Rhino5. The plug-in is available and loaded in RhinoOptions\Plug-ins. However, when I type the command, nothing seems to happen and I cannot figure out.
Therefore, I wanted to ask you if you could take a look at what am I doing wrong.
your problem is likely that you’ve created a command script. Try to use this code instead and compile it with the RhinoScriptCompiler:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def Hola2():
# get a point
point = rs.GetPoint("Pick a point")
if point:
rs.AddPoint(point)
Hola2()
Note that i changed these imports from your script:
Unfortunately if doesn’t runt yet. Here are the list of steps I’m Following:
Create hola2.py file with the aforementioned code:
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
def Hola10():
# get a point
point = rs.GetPoint(“Pick a point”)
if point:
rs.AddPoint(point)
Open RhinoScriptCompiler
2.1) “N” for new project
2.2) “P” for plugging settings -> fille plug-in name and folder where I want to save plug-in (i.e. C.\Users\FolderX)
2.3) “C” for commands settings -> select hola2.py script
2.4) “B” for Build the current project -> “P” for just plug-in
Once the plug-in is created, I open Rhino5 and go to folder where plug-in is saved (i.e C.\Users\FolderX).
Then Drag and Drop plug-in file in Rhino.
Type hola2 command in command line -> Command: hola2 appears but Nothing occurs afters that
I have to say I’m fearly new to Rhino (but have been coding in Python for several years). However, I’m not able to find what I’m doing wrong…
@gerard.guell, very sorry, after testing this on my system i see the same as you got, even when i install the plugin with the built Rhi installer when Rhino is closed. The plugin gets installed and loaded in V5 and V6 but nothing happens when running the command, my loading message is printed though.
Do you find (multiple) versions of your plugin there ?
@stevebaer, has the RhinoScriptCompiler (current version) been tested recently ? I’ve even tried to reference the x64 RhinoCommon.dll but get the same result. Does the plugin below load on your end (V5 or V6) and does the included HolaCommand prompt for a point ?
Hi @clement or anybody else having experience with this,
I’m trying to create a RHI installer for the first time and get stuck. I’ve been going over the steps on this page 3 times but seem to miss something fundamental. Even when I just try to create the exact example they provide I get “An unexpected error has occurred during installation.” when trying to install. Anybody that can give me a clue here?
Hi @siemen, i never used this way to compile my scripts to a plugin as it failed for various reasons. If you want to have full control over (multiple) commands in one plugin, i would recommend to use the RhinoScriptCompiler for it.
Your script would then just look like below, the RunCommand structure is not required and you do not have to append _cmd to your script file name.
def MyFunctionName():
print "Hello World"
# get a point
point = rs.GetPoint("Pick a point")
if point:
rs.AddPoint(point)
# call it
MyFunctionName()
The command name it registers upon installation will be the name of the python script file, eg. If you name it MakePoint.py the command is called by typing MakePoint to the command line.
_
c.
I see, does that work for v6 as well? Might give it a go
@pascal or @will, since your names are on the page I’m trying to use, could you help out and see what I’m doing wrong? If not just so that others don’t run into the same problem as I am.
Still, (not towards you, clement) I think it might be worth checking what I did wrong when I was following along the steps on the developers website. To find out whether I did something wrong (and what?) or something is wrong/not obvious with the steps described there.