Jump to content

DeSignature

Member
  • Content Count

    31
  • Joined

  • Last visited

Community Reputation

0 Neutral

About DeSignature

  • Rank
    Greenhorn

Personal Information

  • Location
    Belgium
  1. DeSignature

    Dialog with n-number of items

    We usualy get by with about 6 relevant hatches, so it seems doable to me, especially if we would restrict the number of hatches in the dialog to about twelve items [1..12]. Wouldn't be bad for the drawing hygiene as well... What would be the easiest way to differentiate between the different hatches. I guess I would have to script something like the code mentioned above, but I noticed it is will not be as easy as that. Any basic suggestions about how to aproach this dialog? or how to approach a dialog with n-number of items?
  2. DeSignature

    Dialog with n-number of items

    Hi, I'm trying to display a legend, but I would like to be able to select the specific hatches to be displayed. Since I don't know how many hatches are used in a drawing, would it be possible to build a dialog according to the - schematic - code below? HatchId := BuildResourceList (66, 14, 'Hulpbronnen - Lijnarceringen', HatchNum); FOR n := 1 TO HatchNum DO CreateCheckBox (DialogId, Item(n), Index2Name(Item(n))); SetFirstLayoutItem (DialogId, Item(n)); SetBelowItem (DialogId, Item(n), Item(n) + 1, 0, 0);
  3. DeSignature

    PIO Button in OIP

    ... still trying to store data in record-fields ... The data actually passes to record fields but are being reset when re-entering the dialogue via the "Button 1"-dialogue. Am I missing a loop somewhere? PROCEDURE Point_Object; CONST Confirm = 01; Cancel = 02; Reset_PIO = 03; k_Icon = 05; PIO_Controls_Palette = 08; k_Palette_Button = 35; VAR PIO_N : STRING; PIO_H, PIO_R, PIO_W : HANDLE; Event, Result : LONGINT; Bool : BOOLEAN; Dial_ID, Dial_Res : INTEGER; D_X, D_Y, D_Z : REAL; PROCEDURE Result_A; BEGIN IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN BEGIN Rect (0, 0, pD_A, pD_B); Message (GetRField (PIO_H, 'Rec_N', 'Data X')); END; END; PROCEDURE Result_B; BEGIN END; PROCEDURE Records; BEGIN NewField ('Rec_N', 'Data X', Concat (D_X), 9, 0); NewField ('Rec_N', 'Data Y', Concat (D_Y), 9, 0); NewField ('Rec_N', 'Data Z', Concat (D_Z), 9, 0); END; PROCEDURE Dialogue_A; PROCEDURE Layout_Dialogue_A; BEGIN Dial_ID := CreateResizableLayout ('Dialogue A', TRUE, 'Confirm', 'Cancel', TRUE, TRUE); CreateCheckBox (Dial_ID, 100, 'Do Something'); CreateStaticText (Dial_ID, 110, 'Data X:', 20); CreateEditReal (Dial_ID, 111, 3, D_X, 20); CreateStaticText (Dial_ID, 120, 'Data Y:', 20); CreateEditReal (Dial_ID, 121, 3, D_Y, 20); CreateStaticText (Dial_ID, 130, 'Data Z:', 20); CreateEditReal (Dial_ID, 131, 3, D_Z, 20); SetFirstLayoutItem (Dial_ID, 100); SetBelowItem (Dial_ID, 100, 110, 0, 0); SetRightItem (Dial_ID, 110, 111, 0, 0); SetBelowItem (Dial_ID, 110, 120, 0, 0); SetRightItem (Dial_ID, 120, 121, 0, 0); SetBelowItem (Dial_ID, 120, 130, 0, 0); SetRightItem (Dial_ID, 130, 131, 0, 0); END; PROCEDURE Dialogue_A_Handler (VAR Item, Data: LONGINT); PROCEDURE Dialogue_A_Settings; BEGIN Bool := GetEditReal (Dial_ID, 111, 3, D_X); Bool := GetEditReal (Dial_ID, 121, 3, D_Y); Bool := GetEditReal (Dial_ID, 131, 3, D_Z); END; PROCEDURE Confirm_Handler; BEGIN IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN BEGIN Bool := GetEditReal (Dial_ID, 111, 3, D_X); Bool := GetEditReal (Dial_ID, 121, 3, D_Y); Bool := GetEditReal (Dial_ID, 131, 3, D_Z); AlrtDialog (Concat (D_X)); SetRField (PIO_H, 'Rec_N', 'Data X' , Concat (D_X)); SetRField (PIO_H, 'Rec_N', 'Data Y' , Concat (D_Y)); SetRField (PIO_H, 'Rec_N', 'Data Z' , Concat (D_Z)); END; END; PROCEDURE Cancel_Handler; BEGIN END; BEGIN CASE Item of SetUpDialogC: Dialogue_A_Settings; 01 : Confirm_Handler; 02 : Cancel_Handler; END; END; BEGIN Layout_Dialogue_A; IF VerifyLayout (Dial_ID) THEN Dial_Res := RunLayoutDialog (Dial_ID, Dialogue_A_Handler); END; PROCEDURE Dialogue_B; BEGIN AlrtDialog ('Here''s nothing going on'); END; BEGIN vsoGetEventInfo (Event, Result); CASE Event OF k_Icon: BEGIN Bool := SetObjPropVS (PIO_Controls_Palette, TRUE); Bool := vsoInsertAllParams; Bool := vsoAppendWidget (12, 100, 'Button 1', 0); Bool := vsoAppendWidget (12, 200, 'Button 2', 0); END; k_Palette_Button: CASE Result OF 100: Dialogue_A; 200: Dialogue_B; END; Reset_PIO: IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN BEGIN PushAttrs; Result_A; Result_B; Records; Record (PIO_H, 'Rec_N'); PopAttrs; END; END; END; RUN (Point_Object);
  4. DeSignature

    PIO Button in OIP

    The endgoal would be a drawing-border with titleblock, since VectorWorks 2014-Fundamentals no longer supports this - fairly handy - bluid-in plugin anymore (Why would someone using Fundamentals not use the remarks & revisions part?) Actualy, it was no longer supported since VW 2009 or 2010, but with some basic "trickery" I was able to use older plugin. Due to some obsolete functions in that plugin it became problematic, so the general plan is a better (to my personal requirements), more complete drawing-border + titleblock plugin. Some extra features would be: _ a legend, based on the used hatches, linetypes and symbols (see code in this topic + some ListBrowser functions); _ a firm-selector (in use); _ better - metric - dimensions (in use); _ better folding marks (Work In Progress (W. I. P.)); _ automatic field updates (drawing name, drawing date, drawing number of total number of drawings, ...) (in use) _ Re-enabled remarks-section (another button in OIP, W. I. P); _ Re-enabled revisions-section (another button i the OIP, W. I. P.); _ ... I've tried the Python-editor but encountered some - really irritating - problems: When the editor displayed an error and the error was fixed correctly in the script, the editor kept displaying this error untill the the editor was restarted. I must say: I haven't checked if this problem is solved by now (or maybe I missed something else, since I don't really know the Python-language).
  5. DeSignature

    PIO Button in OIP

    Of course I didn't, but I do believe this is another option Hippothamus suggested in his post from 05/20. In the actual PIO (of which this code is just a part) there is already a record being created, I was able to integrate these fileds into that record, so stricktly spoken there is no extra record being created. Considering there might easily about 20 booleans being created in this part: _ Is there a major disadvantage in using records? _ Is there a limit to the number of fields? I was hoping to keep a clear view by using different (Dyn)Arrays. And by the way: these suggestions are never too late, there are no lives at stake, I'm just in an everlasting learning-proces, so the're always welcome.
  6. DeSignature

    PIO Button in OIP

    This should be a bit better: PROCEDURE PIOButtonInOIP; CONST Reset_PIO = 03; PushIcon = 05; PushButton = 35; CR = Chr (13); VAR PIO_N : STRING; PIO_H, PIO_R, PIO_W : HANDLE; Event_Id, Event_Result : LONGINT; Dial_Id, Dial_Result : LONGINT; Result : BOOLEAN; Bool, Item : ARRAY [1 .. 2] OF BOOLEAN; PROCEDURE Dialog; PROCEDURE DialogLayout; BEGIN Dial_Id := CreateLayout ('Custom Dialog Box', TRUE, 'OK', 'Cancel'); CreateCheckBox (Dial_Id, 04, 'Draw Rectangle A'); CreateCheckBox (Dial_Id, 05, 'Draw Rectangle B'); SetFirstLayoutItem (Dial_Id, 04); SetBelowItem (Dial_Id, 04, 05, 0, 0); END; PROCEDURE DialogEvents (VAR Item: LONGINT; Data: LONGINT); PROCEDURE DialogSettings; BEGIN SetBooleanItem (Dial_Id, 04, Bool [1]); SetBooleanItem (Dial_Id, 05, Bool [2]); END; PROCEDURE EventOK; BEGIN GetBooleanItem (Dial_Id, 04, Bool [1]); GetBooleanItem (Dial_Id, 05, Bool [2]); NewField ('Bools', 'Item [1]', Concat (Bool [1]), 2, 1); NewField ('Bools', 'Item [2]', Concat (Bool [2]), 2, 1); IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN BEGIN SetRField (PIO_H, 'Bools', 'Item [1]', Concat (Bool [1])); SetRField (PIO_H, 'Bools', 'Item [2]', Concat (Bool [2])); END; END; PROCEDURE EventCancel; BEGIN END; BEGIN CASE Item OF SetupDialogC: DialogSettings; 01: EventOK; 02: EventCancel; END; END; BEGIN DialogLayout; IF VerifyLayout (Dial_Id) THEN Dial_Result := RunLayoutDialog (Dial_Id, DialogEvents); IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN Message ('Bool [1] = ', Bool [1], CR, 'Bool [2] = ', Bool [2], CR, CR, 'Item [1] = ', GetRField (PIO_H, 'Bools', 'Item [1]'), CR, 'Item [2] = ', GetRField (PIO_H, 'Bools', 'Item [2]')); END; PROCEDURE Geometry; BEGIN IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN BEGIN Record (PIO_H, 'Bools'); IF GetRField (PIO_H, 'Bools', 'Item [1]') = 'True' THEN Rect (0, 0, 20, 10); IF GetRField (PIO_H, 'Bools', 'Item [2]') = 'True' THEN Rect (0, 15, 20, 25); END; END; BEGIN vsoGetEventInfo (Event_Id, Event_Result); CASE Event_Id OF PushIcon: BEGIN Result := SetObjPropVS (08, TRUE); Result := vsoInsertAllParams; Result := vsoAppendWidget (12, 100, 'Button', 0); END; PushButton: CASE Event_Result OF 100: Dialog; END; Reset_PIO: Geometry; END; ResetObject (PIO_H); END; RUN (PIOButtonInOIP); This creates geometry inside the PIO after the PushButton-Event. I'm sure the code is liable for improvements, so if anyone would care to make the efford, please do so (again ...) Thanks for all the suggestions. Next question/topic will be about storing the data in the 'Item [ ]-fields'. @Hippothamus: Before calling these DynArrays my friend, I guess I'll have to get acquainted to them ...
  7. DeSignature

    PIO Button in OIP

    Josh, What if one doesn't know how many parameters will be used in the PIO? Since you have to define (i. e. name) all the __parameters in the parameter setup, you should know - at least - how many parameters will be used, which I don't. That is why I tried to write them to a Record, because I think (so, I'm not sure) that it's possible to write an undefined number of fields to a record. I think this is what Hippothamus suggested. For now, I'll experiment a bit with your - very helpful - suggestions and see where it takes me. Thanks.
  8. DeSignature

    PIO Button in OIP

    Well ... I've tried some different scenario's, but ... Hope you don't me dropping some code of one them (Point Object): PROCEDURE PIOButtonInOIP; CONST Reset_PIO = 03; PushIcon = 05; PushButton = 35; VAR PIO_N : STRING; PIO_H, PIO_R, PIO_W : HANDLE; Event_Id, Event_Result : LONGINT; Dial_Id, Dial_Result : LONGINT; Result : BOOLEAN; Bool, Item : ARRAY [1 .. 2] OF BOOLEAN; PROCEDURE Dialog; PROCEDURE DialogLayout; BEGIN Dial_Id := CreateLayout ('Custom Dialog Box', TRUE, 'OK', 'Cancel'); CreateCheckBox (Dial_Id, 04, 'Draw Rectangle A'); CreateCheckBox (Dial_Id, 05, 'Draw Rectangle B'); SetFirstLayoutItem (Dial_Id, 04); SetBelowItem (Dial_Id, 04, 05, 0, 0); END; PROCEDURE DialogEvents (VAR Item: LONGINT; Data: LONGINT); PROCEDURE DialogSettings; BEGIN SetBooleanItem (Dial_Id, 04, FALSE); SetBooleanItem (Dial_Id, 05, FALSE); END; PROCEDURE EventOK; BEGIN GetBooleanItem (Dial_Id, 04, Bool [01]); GetBooleanItem (Dial_Id, 05, Bool [02]); END; PROCEDURE EventCancel; BEGIN END; BEGIN CASE Item OF SetupDialogC: DialogSettings; 01: EventOK; 02: EventCancel; END; END; PROCEDURE Bools; BEGIN IF Bool [01] = TRUE THEN NewField ('Bools', 'Item [01]', 'TRUE', 2, 1); IF Bool [02] = TRUE THEN NewField ('Bools', 'Item [02]', 'TRUE', 2, 1); IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN SetRecord (PIO_H, 'Bools'); IF Bool [01] = TRUE THEN SetRfield (PIO_H, 'Bools', 'Item [01]', 'TRUE'); IF Bool [02] = TRUE THEN SetRfield (PIO_H, 'Bools', 'Item [02]', 'TRUE'); END; BEGIN DialogLayout; IF VerifyLayout (Dial_Id) THEN Dial_Result := RunLayoutDialog (Dial_Id, DialogEvents); Bools; END; PROCEDURE Geometry; BEGIN IF GetCustomObjectInfo (PIO_N, PIO_H, PIO_R, PIO_W) THEN BEGIN IF GetRField (PIO_H, 'Bools', 'Item [01]') = 'TRUE' THEN Rect (0, -75, 100, -25); IF GetRField (PIO_H, 'Bools', 'Item [02]') = 'TRUE' THEN Rect (0, 25, 100, 75); Message ('Item [01]: ', Item [01], Chr (13), 'Item [02]: ', Item [02]); END; END; BEGIN vsoGetEventInfo (Event_Id, Event_Result); CASE Event_Id OF PushIcon: BEGIN Result := SetObjPropVS (08, TRUE); Result := vsoInsertAllParams; Result := vsoAppendWidget (12, 100, 'Button', 0); END; PushButton: CASE Event_Result OF 100: Dialog; END; Reset_PIO: BEGIN Geometry; END; END; END; RUN (PIOButtonInOIP); The OIP tells me that Item [01] & [02] are TRUE, but the Message ( ) tells me the're FALSE, so I know there's something(s) fundamentally wrong. (By the way, is anybody else experiencing some trouble with the 'Preview Post' on this forum while posting?)
  9. DeSignature

    PIO Button in OIP

    @ Mr. Dunning, I wasn't very clear on that one. The values aren't lost when exiting the Dialog, but do seem to be lost when re-entering the Dialog. @ Mr. Geerts, For now I'm trying to use the SetRField to control 1 hidden parameter, I was hoping that this parameter could control all the different booleans from the Dialog, but apparently, "that kite won't go up", for now. @ Mr. Benghiat, Could it be that the Dialog behind the Button of the PIO is being reset after exiting, not the PIO itself? The PIO (and its different button-parts) should keep it's properties per Sheet-Layer, but I guess that criterium wouldn't be that hard to script ...
  10. DeSignature

    PIO Button in OIP

    Probably trying too much too fast, but ...: How can I reset the PIO and keep the changes executed by the button-click-event? If I click the button that opens a Custom Dialog Box - containing some boolean items - and change some of these items, then after I close this dialog box, the PIO is being reset bij the kResetObject-event. By resetting the object all the boolean items go back to their initial vanlue (seems logical), but how can I maintain these changes in the memory of the PIO? (Meanwhile, I guess I'd better start looking up on how to store stuff in a Dynamic Array ...)
  11. DeSignature

    PIO Button in OIP

    Yes, but that would be the easy way out if it were not, that the legend would just be a part of the plugin, and also, the plugin wouldn't answer the initial question. Basically, still trying to understand these Events ... but thanks anyway.
  12. DeSignature

    PIO Button in OIP

    I've opted the second option (I think): Let the script look for hatches & line patterns in a ListBrowser and then display all the results in the legend using one simple standard Boolean parameter ('Show Legend'). This should also answer your question: The geometry would consist of some hatched rectangles, some patterned lines, perhaps some symbols and some text explaining the forementioned. Anyway the first option might answer the initial question: "How to create geometry inside a PIO by pushing a button". The current Dialogbox appearing after pushing the button creates the desired geometry, but it does so outside the PIO. If I understand you correctly, the button shouldn't control some Procedure(s) in the script, but should control parameters that control some Procedure(s) in the script. Thanks.
  13. DeSignature

    PIO Button in OIP

    Based on the info found on this forum and on the VectorLab-website, I've managed to create a PIO (Plug In Object) with a custom button in the OIP (Object Info Palette). I would like to use this button to create a legend in a custom Titleblock + geometry Workflow: push the button -> mark some boolean items in a Custom Dialog Box -> close the Dialog -> result On the VectorLab-website there is a note about creating geometry inside or outside the PIO, no problem up to here. How can we create a geometry inside the PIO after pushing the button. I can create the geometry after pushing the button, but then the geometry is created outside the geometry and I can create the geometry inside the PIO but then the button is rather useless as it's created by another part of the PIO-script.
  14. DeSignature

    3d-Array

    I'll keep that in mind. Meanwhile I found out that the code above doens't work properly in a PIO, just because of the following lines (...) RectangleN (Pos [a, z].P [z], Pos [z, a].P [a], 1, 0, Len [a, z].L [z], Len [z, a].L [a]); Ext_H := HExtrude (LNewObj, Bot [a, z].P [n], Top [a, z]. P [n]); (...) In a PIO this line should be replaced by: (...) BeginXtrd (Bot [a, z].P [n], Top [a, z]. P [n]); RectangleN (Pos [a, z].P [z], Pos [z, a].P [a], 1, 0, Len [a, z].L [z], Len [z, a].L [a]); EndXtrd; (...)
  15. DeSignature

    3d-Array

    Not really sure how I got there, but I'm there: PROCEDURE Silver_Constant; CONST Psi = (1 / 2 + SQRT (23 / 3) / 6) ^ (1 / 3) + (1 / 2 - SQRT (23 / 3) / 6) ^ (1 / 3); TYPE STRUCTUUR = STRUCTURE P, L : ARRAY [0..6] OF REAL; END; VAR Pos, Len : ARRAY [0..6, 0..6] OF STRUCTUUR; Bot, Top : ARRAY [0..6, 0..6] OF STRUCTUUR; a, z, n : LONGINT; SB : REAL; Ext_H : HANDLE; BEGIN SB := RealDialog ('Smallest Block Dimensions = ', '100'); FOR a := 0 TO 6 DO BEGIN FOR z := 6 DOWNTO 0 DO BEGIN FOR n := 6 DOWNTO 0 DO BEGIN Pos [a, z].P [n] := SB * (SB - (SB * Psi ^ a)) / (SB - (SB * Psi)); Len [a, z].L [n] := SB * Psi ^ a; Bot [a, z].P [n] := SB * (SB - (SB * Psi ^ n)) / (SB - (SB * Psi)); Top [a, z].P [n] := (Bot [a, z].P [n]) + (SB * Psi ^ n); RectangleN (Pos [a, z].P [z], Pos [z, a].P [a], 1, 0, Len [a, z].L [z], Len [z, a].L [a]); Ext_H := HExtrude (LNewObj, Bot [a, z].P [n], Top [a, z]. P [n]); END; END; END; END; RUN (Silver_Constant); If anyone feels like to elaborate on what is actualy happening here, please do.

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×