+ Reply to Thread
Results 1 to 7 of 7

Thread: rs.AddText gives Runtime error (MissingMemberException)

  1. #1

    rs.AddText gives Runtime error (MissingMemberException)

    For some reason I cannot make rs.AddTest work. I tested a couple of different examples from different posts for rs.Addtext and python gives me the same error as:

    Runtime error (MissingMemberException): 'CustomTable' object has no attribute 'AddText'

    What am I doing wrong?

    Thanks,
    Mostapha

  2. #2

    scriptcontext.doc.Objects missing AddText

    OK! Apparently there is no AddText in scriptcontext.doc.Objects and I guess this causes the error. I attached the preview. What should I do about this? Thanks for your help.
    Attached Images

  3. #3
    Senior Member Steve Baer's Avatar
    Join Date
    Apr 2010
    Location
    Seattle
    Posts
    1,463
    Blog Entries
    19
    Hi Mostapha,
    I believe this error is specific to the grasshopper-python component. I added a bug to the ghpython issue tracker for this.
    https://github.com/mcneel/ghpython/issues/38
    Thanks,
    -Steve

  4. #4
    Hi Steve,
    Thank you for clarification. You may want to add rs.AddTextDot to the same issue tracker then.
    Mostapha

  5. #5
    Hi Mostapha

    Yes, this is a limitation of the Grasshopper data types. At the moment there are no text or text dot objects, so even though you could create them in the component, there is then no direct way to make Grasshopper really aware of them. As soon as Grasshopper will support these types, the GhPython component will be changed to handle them. I'll keep the bugtracker item open, but this is not something that can be changed from GhPython. I've added a more descriptive error message, though, for the next release.

    On the other hand, if in special occasions you want to add this type of object to the Rhino document, go ahead, you can: for this, just switch scriptcontext.doc:

    Python Code:
      import Rhino
      import scriptcontext
      scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc
      #modify the Rhino document here
      scriptcontext.doc = ghdoc

    After this, you will be targeting the Rhino document.
    You can go back by either keeping track of what scriptcontext.doc was before, or just assigning it to ghdoc.

    Thanks,
    - Giulio
    _________________
    giulio@mcneel.com

  6. #6
    Hi Giulio! Thank you so much for the tip. I'll give it a try soon. Regards, Mostapha

  7. #7
    Hi Giulio and Steve,

    I tried Giulio's suggestion. It adds the text but bake it into the document. I need to keep the text parametric. I assume this is the nature of Rhino Doc to bake the object as soon as it execute the command and there should be no way to stop it from that.

    I tried few different other ways such as importing grasshopper components (Grasshopper.Kernel.Components.GH_TextTagComponent ) but I had no chance to make it work. Can you give me an example of adding text using Grasshopper SDK. Nevertheless is there any available help document for grasshopper SDK? It could be so helpful in general.

    Thanks,
    Mostapha

    PS: For ones whom might need the Grasshopper SDK. You can download it from Help> Download SDK Help... in Grasshopper!!!
    Last edited by Mostapha; 08-23-2012 at 10:32 PM. Reason: Add the answer!

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts