Jump to content

alberto72

Member
  • Posts

    11
  • Joined

  • Last visited

Posts posted by alberto72

  1. I've setup a 2d linear Pio that draws insulation layer, with arc and lines,  with a given thickness.

    It works fine but it fails in junction for angles that differs from 90 degreese.

    Therefore I wish to know if someone knows a method to crop/hide/mask a Pio geometry likewise to the way we use to crop our Viewports or Bitmap images (without using SDK of course).
    I've tried to insert in my code a white/colored polygon that hides the backmost geometry, but in joining two PIOs it's unusable.

    If it not exist I would have to proceed in  such a way as to check whether the points of each individual arc or line fall within a given perimeter: a job that is not impossible but extremely more complicated.

    Thank you in advance for your valuable advice!

    2D insulation PIO.jpg.png

  2. 13 hours ago, Sam Jones said:

    Josh's response is one of those amazing responses that is both complete, if a little cryptic, and the tip of the iceberg.  I would stay away from creating parameters via a script.  If I assume that you are using widgets to display the values of the parameters, you are going to have to maintain the separate record that Josh describes and shuttle values of the record fields back and forth to and from the widgets.  The "to and from" part is not clear to me.  Are you planning on having users enter/choose values by changing the widgets in the OIP, or is the OIP just there to display values.  I'm having a hard time imagining why you want to create the parameters with a script.  Are you trying to create a dynamic OIP that changes its own fields on the fly?  Could you describe how you want to use this PIO such that you need to use a script to create it?

    During PIO development, it is often required to modify OIP by adding, removing, hiding, enabling, or moving fields (via Plugin Manager -> Edit Configuration…) but what I get in the Object Palette Info, is a lot of mess: there’s not immediate update (for me) of the changes to the correct field sequence without restarting the program.

     

    This aspect is quite annoying, so I thought that widgets were an advanced method compared to the "Plug-in Manager " method

     

    Now, after your valuable advice, I don’t see the advantage of using them.

    Noting the immense workflow that Josha has laid out for us, I think I will limit myself to the use of the button widgets (kEventID_OnUIButtonHit = 35) or even custom dialogs.

  3. Hi everyone. I'm developing a PIO trying to insert all the parameters via script avoiding using the parameters window (NOTE: I still don't understand if it's possible, I hope so). Thanks to your the previous posts everything works fine but can someone explain me with which function I should use to get the current value (string or real) of the widget field to assign to my script variable? There seem to be only pop-up menu commands in the "VS:Function Reference" list. Thank you for the tip.

  4. I tried to implement your advice but it was unsuccessful. It seems that only some instructions are executed during the dialogue loop such as:AlrtDialog(), CreateText()+ReDrawAll(). Here is my Dialog_Handler function which I'm working at.....

    def Dialog_Handler(item, data):
            (ok, objectName, objectHand, recordHand, wallHand) = GetCustomObjectInfo()
    
            def update_and_execute():#===== this subroutine is intended to be used with item==1 and item ==12605
                # ========retrieving values======
                esito,inter.c1 = GetEditReal(dialogID,12,3)
                esito,inter.c2 = GetEditReal(dialogID,14,3)
                (outSelectedIndex, outSelectedChoiceText) =GetSelectedChoiceInfo(dialogID, 16, 0)
                inter.d = outSelectedChoiceText
                # ========= updating object info palette===
                SetRField(objectHand, GetName(recordHand), 'ci',str(inter.c1/10) )
                SetRField(objectHand, GetName(recordHand), 'cf',str(inter.c2/10))
                SetRField(objectHand, GetName(recordHand), 'diam', inter.d)
                ResetObject(objectHand)
    
            if item == 12255:# SetupDialogC -> My Custom Window Init
                AddChoice(dialogID, 16, '8', 0)
                AddChoice(dialogID, 16, '10', 1)
                AddChoice(dialogID, 16, '12', 2)
                if v3 =="8":
                    choice = 0
                elif v3 =="10":
                    choice = 1
                elif v3 =="12":
                    choice = 2
                SelectChoice(dialogID, 16, choice, False)#=====update pulldown menu -> OK!
    
            elif item == 2:#=====Cancel button pressed -> OK!
                pass
    
            elif item ==1: #====  OK button pressed -> OK!
                update_and_execute()
    
            elif item == 12605 :# ======Preview button pressed ->
                AlrtDialog(('item= '+ str(item) + '   data= '+ str(data)))#===== THIS WORKS 
                update_and_execute()#=====THIS DOESN'T REGENERATE PIO AS item==1 DOES !
                ResetObject(objectHand)#=====THIS DOESN'T WORK TOO !
                CreateText(str(item))#==== THIS WORKS WITH ReDrawAll() !
                ReDrawAll()
                

     

  5. I've got an event-enabled linear PIO that raise a custom dialog with a double click on it. It works fine swapping values between custom dialog and info object palette. I've implemented dialog handle procedure with item 1 (OK Button), item 2 (CancelButton). Now I would like to add item 12605 (preview button) which would operate as the Ok button (updating PIO ), but without exit from dialog. It doesn't work at all because seems that  you must exit from the dialog event loop to obtain PIO updating.
    Thanks in advance for any suggestion.

  6. This is my answer. I create a new command called "Join Linear PIOs", placed under "Edit" menù and this is its code:

    Procedure JoinTwoSelectedLinearPios;
    VAR
    h1,h2:HANDLE;
    P1,P2,P3,P4:POINT;
    P:POINT;
    parallel     :BOOLEAN;
    intOnLines   :BOOLEAN;
    d1,d2,d3,d4:REAL;
    BEGIN
    h1:=FSActLayer;
    h2:=NextSObj(h1);
    GetSegPt1(h1,P1.x,P1.y);
    GetSegPt2(h1,P2.x,P2.y);
    GetSegPt1(h2,P3.x,P3.y);
    GetSegPt2(h2,P4.x,P4.y);
    LineLineIntersection(P1,P2,P3,P4,parallel,intOnlines,P);
    {====gather P1,P2,P3,P4 distances from P========}
        IF (parallel=FALSE) THEN BEGIN
            d1:=Distance(P1.x,P1.y,P.x,P.y);
            d2:=Distance(P2.x,P2.y,P.x,P.y);
            d3:=Distance(P3.x,P3.y,P.x,P.y);
            d4:=Distance(P4.x,P4.y,P.x,P.y);
        {    ===== join PIOs trimming the shortest side...=====}
            IF d1<d2 THEN SetSegPt1(h1,P.x,p.y) ELSE SetSegPt2(h1,P.x,p.y);
            IF d3<d4 THEN SetSegPt1(h2,P.x,p.y) ELSE SetSegPt2(h2,P.x,p.y);
        END;
    END;
    RUN(JoinTwoSelectedLinearPios);

    Well, it doesn't check if h1 and h2 are linear PIO's or other objects, but it works with 2d Lines too.

    Hope to be useful....

    2D Linear Objs.png

×
×
  • Create New...