Jump to content

Sam Jones

Member
  • Posts

    1,191
  • Joined

  • Last visited

Posts posted by Sam Jones

  1.  

    7 hours ago, kevin.hayward said:

    "If I can get a reference to a lighting device in the resource manager, can I insert said lighting device programmatically?"

     

    One step at a time:

     

    How would you know the code,  "1*D", represented any Lighting Device in you resource manager?

  2. As Josh said place a static text item and then change the item type.  Do this with the pop up menu in the OIP.

    18 hours ago, JBenghiat said:

    The layout items are all plug-in objects; insert a static text item and then change it's type to the desired item.

     

    image.png.5920d72c63c3822faab9a8b625b6eba3.png

    • Like 1
  3. The functionality you originally described is possible, I think, but it is way more involved to code, and it all hinges on the correct exact name of the symbol you need being stored in Lightkey[x].  If you jump that hurdle, you have to:

    Build a resource list

    Scan the list for the symbol name

    Go into the symbol definition to read values you need like Instrument Type (true name Inst Type) from the Light Info Record attached to the symbol definition, and do all the steps mentioned above.

    So, (pause here and take a breath), how badly do you need the functionality?  What you need to do is not rocket science, but it is way more involved than what you were hoping for.

    Kind of an interesting problem actually, but everything hinges on having LightKey[x] provide the exact symbol name.  You might make a translation table of LightKey to symbol name, but that is just another step and want that would need to be maintained.

     

    BTW:

    NewLD.Tilt = a1

    NewLD.Pan = a2

    just translates to

    SetRField(NewLD, 'Lighting Device', Tilt, a1);

    SetRField(NewLD, 'Lighting Device', Pay, a2);

  4. That's how you do it.

    CreateCustomObject('Lighting Device', X, Y, RotationAngle);

    but it's going to need more info than is in the worksheet you show.  It is likely you will need to either by hand or by script transfer the information from the worksheet you show to one that will then have all you need and that you will read the values from.

     

    Get the handle to the fixture you just placed with

    CreateCustomObject('Lighting Device', X, Y, RotationAngle);

     

    NewLight := LNewObj;

     

    You are going to need way more info in your worksheet, because you need to set the parameters of the Lighting Device, and you will need to set fields in your code that the "Lighting Device Tool" would normally pull from the symbol selected.  At a minimum you will need the Symbol Name of the fixture you want to place.  You can then go into the symbol definition and pull some of the information from the "Light Info Record" attached to the symbol definition.  This all assumes that the needed symbols are already in the document.

     

    There will be information you want to set that is not in the "Light Info Record" that had better be in your worksheet.  Getting the correct symbol name from the key referenced by the 'Qty and Code' column seems unlikely so you would have to reference some translation file or worksheet.

     

    If you have the information, setting the parameters is straight forward.
    SetRField(NewLD, 'Lighting Device', 'Symbol Name',  'Light Instr Martin MAC Viper Profile');
    SetRField(NewLD, 'Lighting Device', 'Inst Type',  'Martin MAC Viper Profile');


    SetRField(NewLD, 'Lighting Device', 'Fixture Mode',  'Martin Mac Viper Profile Basic');
    SetRField(NewLD, 'Lighting Device', 'Fixture Mode',  '1225W');  

    {Etc, etc, ...}

     

    I'm not sure what the values in your Switch Mode columns are, but you would need to figure that out and send the values to the correct parameters.

     

    Lastly,
    ResetObject(NewLD);

     

    None of this is rocket science, but it is a rather involved script that would be broken by entries in the Calculux worksheet that you did not match correctly/exactly.

    Where does the Calculux table come from?  Maybe there is better way to get the information.  Probably not, but maybe.

    How badly do you want the functionality you describe?  You might aim lower by making a script to mark the locations with loci or a symbol and then placing the lights by hand with the Lighting Device Tool.

     

    It would be nice to use CallToolByName() in your script, but doing that with the Lighting Device Tool makes you click on locations to place the lights.

  5. Scripting is a lot easier than most people think, but it is not as easy as Michael makes it out to be.  It was for him, but if you did not have any computer class that introduced you to programming, you're screwed.  OK, it's not that bad, but learning about variable types and assignment, flow of control, and conditional testing can be daunting without a guiding hand.  As I said at the beginning, it is easier than most people think, but the entrance requirements are usually a big need for simplifying a repetitive simple task, and someone to point the way.  BTW, if you find such a often performed, simple task, the "Customization" forum is filled with people who will help guide you to creating your first command or tool.  Spending way more time in helping you than you thought would ever happen. 

    All the above being said, many of us that script in VW look at the work of other scripters, and decide that reinventing the wheel is not worth it, and we purchase the work of others.  Some reinvent the wheel, and sometimes make a better wheel.  In that way better defining both the task and the workflow to attack it.  Sometimes they do that with existing VW commands improving the workflow VW attempted to simplify.

     

     

    39 minutes ago, michaelk said:

    There is no way someone who made a career in computer programming will have the insight into a design problem or workflow problem the same way as someone who designs every day.

    This statement is crucial.  There are going to be times that users create tools that the people at VW never imagined or imagined wrong.  The scripting environment that has been provided by VW is the most important tool it has provided to any user.  If you don't script, you have benefited from the work of someone who has no matter what your industry focus is.  Embrace that, and your life with VW will be much more pleasant.  Nobody, wants to spend more money, but how badly (how much time or mental effort is saved) do you need the functionality that VW failed to provide in the shipping program?  Understand that by providing a scripting environment, they kind have covered all the bases.

    • Like 3
  6. 15 hours ago, mjm said:

    That's very interesting about the OIP being custom. No idea how that would could happen. Does that happen when opening 

    It can happen if you are working on a drawing that someone else has started dropping Lighting Devices (LDs)  into.  Those LDs will show the OIP used by the person who placed them and will be the starting default going forward.  You will need to go to and select File / Document Settings / Spotlight Preferences.  In the resulting dialog,  select "Parameters" in the left hand column.  In the "Settings" drop down menu, select "<Spotlight>, and this will return the OIP to the Spotlight default display. 

    Of course, you could also make your own custom display.

     

    image.thumb.png.44099b7850081ee328d9184e42aa4c03.png

     

    • Like 2
  7. 15 hours ago, mjm said:

    which choice do you make: removing Light Info from the clamps or  better muscle memory?

    Let first say that how SSS performs with Lighting Devices is quite marvelous and very helpful.  As for my preference in fixture/clamp configuration, I much prefer to keep the clamp as part of the fixture.  I have no need to count clamps.  I count fixtures.  If necessary, I count the fixtures that don't need them.  Side arms and similar steel are another matter.  I count them separately, and not as accessories.  I fear this is just me.  That kind of granularity I prefer to keep in data records, not separate drawing objects.

    • Like 2
  8. Such a script menu command exists in AutoPlot Tools for Spotlight, attached but encrypted, but this task is an excellent way to start scripting.  Since I sell a solution let me just say that you probably want to be sure to be careful of the "visual", = (V), criteria in whatever "ForEach..." command you try to go with.  If have "Show" or "Show/Snap" layer criteria selected it is possible to select objects on layers that are visible, but will not display selected objects.  This has bitten many a command in the ... .

    Attached command uses the dialog below, and automatically enters the values from the first selected Lighting Device on the active layer.

     

     

    image.thumb.png.8500c6880be4397b28b78274badfe365.pngSelect by Field(s) Value(s).vsm

     

     

     

  9. Unfortunately, if the two studios are in the same drawing, the command will combine all the accessories in to the into one worksheet every time you run the command.  You would need to have each studio in its own file.

    The most time consuming part of making the command able to filter by layer, is creating the user interface to provide that choice.  I will see if I can whip out a command that will only make worksheets by layer, and then work on the UI later.  No guarantees, so it's unlikely to get to you in time, but we'll see.

    • Like 2
  10. 6 hours ago, benjaminauer said:

    Also tried Sams Script, does not really do as advertised, only turns off beams but does not restore the shaded mode, everything stays shaded

    Actually, it does do as advertised.  It turns off all the beams.  You also want it to restore the shaded mode.  What shaded mode should it return to?

  11. I would like to convert a symbol to a group and then scale the group.  Converting the symbol is easy with , but getting a handle to pass the HScale2D routine seems to fail.  The code below fails, and yes the FSActLayer is a symbol.

     

    PROCEDURE UnGroupAndScale;

    VAR
        Obj        :HANDLE;
        Grp        :HANDLE;
        X, Y    :REAL;

    BEGIN
        Obj := FSActlayer;

        GetSymLoc(Obj, X, Y);
        SymbolToGroup(Obj, 2);

        HScale2D(LNewObj, X, Y, 0.2, 0.2, TRUE);
        ReDrawAll
    END;
    RUN(UnGroupAndScale);

     

    So how should I do this?

     

    TIA yet again.

  12. 21 hours ago, Robert Anderson said:

    Turned out to be more work to write the code to do the work than just to do the work.

    Still usually true.  If you don't do it a lot, don't bother to script it.  (Unless you have fun scripting.  See @Pat Stanford 's many script replies.)  As a third party developer, creating the command used occasionally by many is close enough.

     

    The ChatGPT is well laid out and clear.  I probably would not thought of ExtrudeAlongPath() function.  I'm curious to see what it produces, after all the errors you mention are corrected.  Although ChatGPT does not seem like it is of any use (yet) for templating (a word?) any mildly complex commands, I will be curious if it can throw up a structure for some of the simple commands that I sometimes throw together.

  13. 1 hour ago, Pat Stanford said:

    then it should return 86 for PIOs and 47 or 48 for Record formats (not sure if it will get the definition (47) or the record (48).

    Nope.  It would seem that PIOs are not a resource.  I hope I'm wrong about that but

     

        ResListID := BuildResourceList( 47, 0, SubFolder, NumResources );
        FOR Index := 1 TO NumResources DO
            BEGIN
                ResName := GetNameFromResourceList( ResListID, Index );
                ResHdl := GetObject( ResName );
                ResType := GetType(ResHdl);
                IF (ResType <> 86) THEN
                    BEGIN

    failed.  ResType always yielded "47" for the PIO name.  (I used the extra variables and lines for debugging purposes).

  14. It is possible to create a list of records in a document using the BuildResourceList( 47, 0, SubFolder, NumResources ) which will produce a resource list of record definitions.  Some Questions:

    Is it possible to filter this list build to not include PIOs?

    If not, is it possible to look at the resulting list and identify the record definition, obtained with GetObject(GetNameFromResourceList( ResListID, Index )),  that is a plug-In, or identify it as not a plug-in?

    The goal here is to produce a list of records in a document that do not belong to plug-in objects, like the list in the Data Pane of the OIP.

×
×
  • Create New...