Jump to content

Hippocode

Member
  • Posts

    796
  • Joined

  • Last visited

Posts posted by Hippocode

  1. If you ever run into limits you might look at User Data, but I believe it's SDK only. Still you could write a VS function to handle your implementation.

    Basically you can attach (structures of) data to any object handle which is very cool.

    I have a junction object that can have unlimited legs, each leg info is dynamically added to the object handle without using a record.

     

    If all you are saving are coordinates you might also consider dynamic controlpoints and or the combination with above.

    This also opens the option of simply moving any of those points if the control handle is visible end enabled.

  2. 18 minutes ago, Art V said:

    Except for a few parametric symbols in the plug-ins folder and the extensio plugin-in items I do not have any custom libraries installed in VW2017. So what is installed by the extensio plugin is probably quite small compared to a regular library, i.e. less than 20 MB.


    I just checked, the 2017 lib will be around 22ish. You could move them away as the 2016 plug-in won't work in 2017 and the library will be refreshed anyway when you get to use the 2017 version.
    You can still copy over stuff afterwards. 

    As a sidenote, I don't have this issue. Maybe this is caused by having 2016 files inside the 2017 folder? You could have a look into that direction and see if converting all files fixes the popup. Just a thought.

  3. 1 hour ago, Will said:

    Is it possible for a PIO to receive an event when a user switches to a layer containing the PIO?

    Thanks

    Will

    Not with VS directly, you can with the SDK.

    On the other hand, there could be a small workaround. Remember that saved views can have scripts assigned ? Well in there you can fake this event, find your object type in the layers that have been made active and do your thing. This would only work if you use your saved view to navigate to this layer.

    Could you explain a bit more of what you are trying to achieve ?

  4. I'm not actively using marionette but isn't there a magnitude node present in the default nodes folder under "math" ?
    I would be surprised if there isn't as this is a really basic math function.

    As a general rule, I wouldn't create and delete objects for the sake of calculating something.
    You might even run into objects being restated when you undo one step and this isn't a performance friendly solution. 

    Magnitude |v| = √( x2 + y+ z2 )
    The magnitude is calculated with the vector between your two points, being v2-v1.

    • Like 1
  5. A bug or not, it's never a good idea to have a parameter contain a special character.

    Since you can localise a parameter, have you tried that instead ? This makes the original name of the param "PARAM" and then you localise it in anything you'd like "PARAM's"
    When working (codewise) with the value you need the first one, the second one is only used when displaying to the end user in the OIP.

  6. From what I've seen myself trying out the plug-in I believe you are correct.
    You even get the same behaviour when you edit the crop, your plug-in is always one step behind.

    Assuming your findings are correct, you need an additional reset of the parent object, the viewport in this case:

    Add a hidden parameter to your object, BOOLEAN default to FALSE. 

    Whenever your code runs, load the value.
    If it's 0 make it 1 and call a RESET to the parent object if it is a viewport. This will cause an additional reset of your object.
    Since the value now is 1, make it zero again but don't reset the parent object or you end up in an endless loop.

    In short, the viewport resets your object for the first time. Now your frame is at the wrong position. You then call a reset on the viewport. 
    If lucky, the viewport now did recalculate it's other group properly. The second reset of your object now draws correctly and stops the loop.

    This is far from ideal and there are other/better ways of doing this but I don't think such functionality is available for VS.
     

     

  7. Have you considered a 3D polygon instead ? You can just draw the centerline/invert of your pipe that way.


    Say locus one (v0) and locus two (v1)

    The vector between them is U=v1-v0. The magnitude of U is the length of that segment.
    The angle depends by which axis but the slope can be calculated by comparing the dz(v1.z-v0.z) with the length.

    Screenshot 2016-09-03 10.05.56.png

    Since you are interested in pipes,
    we have some improvements coming for our mechanical plug-ins in 2017.
    All these parameters from the OIP can be shown by tags on the drawing and they update whenever you move the component as well.

  8. The function reference always clearly explains which variables it takes and which it returns.

    Parameters

    objectHand HANDLE Handle to object.

    Return Value

    Returns a HANDLE to the path polygon.

    You can get a handle to your object using GetCustomObjectInfo. Look it up on the function reference as it returns multiple parameters. You'll see I also use that function in the example I've sent you.

  9. I think you are mixing up the part 'tool' and 'parametric object'.

    As I've said earlier, when you create an object with the VS editor you choose a type and it will automatically bind the tool for it. You don't need to alter the tool as it will work just like that.

    The tool will, once completed, create an instance of your object and insert the path you just created. It is your task to have your object load that path, and use it to draw something.

    Easiest way is to duplicate the path and use that as a base for your extrude.

    You can retrieve parameter values by preceding them with a P. Parameters itself are added uding the editor.

    I'll mail some sample code of an old path based plug-in.

    But look out. One of these days I'm going to crack open the SDK and give it a try. When that happens I'll come to Belgium for a month or two and drive you crazy with questions.

    The 2017 version of my module will have a partially open source SDK project available to extend/tweak my module. Very cool, be sure to look at it.

    Sounds great, always welcome ;)

  10. Lucky you it works the other way around.

    If you create a plug-in you have to choose a standard tool that will be assigned to it. When you create the plug-in in the editor you can choose the path type (2D or 3D) and boom your tool is ready. ( assuming you don't want any special stuff)

    Just make sure that your plug-in draws something based on the path of the object. The tool will create the path for you.

    I never customized tools using VS myself, only using the SDK. No samples to give :)

    • Like 1
  11. Hi there,

    I have a simple script and I can not figure out, what the problem is:

    PROCEDURE test;

    VAR

    numsel :INTEGER;

    BEGIN

    numsel := Count((SEL=TRUE));

    message (numsel);

    END;

    run(test);

    The script shows the number of the selected objects.

    The problem is: if I run this script from within the annotations of a viewport on layout layer I always get 1 - no matter how many objects are selected.

    If I run it while having selected objects on a construction layer or even directly on a layout layer the script message shows the exact number of selected objects.

    Any ideas?

    Thank you all

    kind regards

    VvierA

    It returns 1 because you have the viewport selected.

    From what you describe I'd say it doesn't return selected objects inside that container.

    When using a foreachobject loop you could define how deep the search has to look but that would traverse everything in the drawing.

    Look at http://developer.vectorworks.net/index.php/VS:GetVPGroup

    to get a handle to the annotations group, then traverse the group and find all selected objects. I believe that's the easiest way.

  12. OK, that's cool.

    Can I divide vectors by integers to get points 1/2, 1/3, 1/4 along a vector?

    Mind blown.

    mk

    While you can probably divide a vector it won't give you the expected result.

    Calculate the unit vector (direction) and the magnitude of the original vector.

    Then any point along the vector = original point + direction * magnitude / divider.

  13. This is a common error when you try to acces an array item that's not there.

    numsel := Count((SEL=TRUE));
    ALLOCATE SObjectHandle[1..numsel];
    zaehl := 1; 
    
    WHILE (objectH <> NIL) DO BEGIN
    
    SObjectHandle[zaehl] := objectH;
    zaehl := zaehl+1;
    objectH := NextSObj(objectH);
    
    END;

    Notice that you define your counter "zaehl " as 1, without checking there is atleast one object selected.

    You try to acces SObjectHandle[1] in a situation where it's not declared (numsel being 0).

    I've also had some weird behavior with dynamic arrays in the past, where I had to declare them size+1 to work in some special cases but I don't think that's the issue now.

×
×
  • Create New...