Ruby scripted Dynamic Attributes reporting Issues

Ruby scripted Dynamic Attributes reporting Issues

Postby JH » Tue Feb 12, 2019 5:20 pm

Hello to Everyone,

In 2016 I began to script a little tool to create some Dynamic Components,
with added Information, for Edgebanding and different Materials,
In the first Iteration I just made a cube, which was then changed thru the
DC Component options to the needed Size, that worked as expected.

Recently I took a look at the Code and changed it, that the drawn Cube has the
right Size, as the User has to put them in an Inputbox-Prompt,
The Components are created using the Point-Method and then Pushpulled (in Ruby).


However, I dont get it why I cannot get the lenx, leny and leny to report in any
Ruby- driven Report-Script I tried, until some User-Interaction with the
Component-Options has been made,
(just clicking in the Inputbox of the DC-Settings-Dialog and applying the already correct Values)
since the Original Report-Feature can report these Values without this User-Interaction.

As far as I can see, the Variables are correctly set, since the DCs are working
as they should besides the Reporting-Thing.


attached is a drawing with some of the scripted Components

Has anyone a clue how I can make them readable to a script?

Thank you in advance!
0
User avatar
JH 
 

Re: Ruby scripted Dynamic Attributes reporting Issues

Postby Dan Rathbun » Sat Mar 23, 2019 10:52 pm

JH wrote:... I dont get it why I cannot get the lenx, leny and leny to report in any
Ruby- driven Report-Script I tried, until some User-Interaction with the
Component-Options has been made, ...

The default values are stored in the DC definition's "dynamic_attributes" dictionary and the DC instance just uses the defaults until the user changes them. When they are different than the default, the DC code will create instance specific attributes in the instance's "dynamic_attributes" dictionary.

So the "rule of thumb" for Ruby coding DCs is to always first check the instance's "dynamic_attributes" dictionary, then check the definition's "dynamic_attributes" dictionary for dynamic attribute values.
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    SketchUcation One-Liner Adverts

    by Ad Machine » 5 minutes ago



    Ad Machine 
    Robot
     



     

    Return to Developers' Forum

    Who is online

    Users browsing this forum: No registered users and 6 guests

    Visit our sponsors: