Jump to content

michaelk

Moderator
  • Content Count

    4,771
  • Joined

  • Last visited

Everything posted by michaelk

  1. That's a good question. I can't find a way to do it in a worksheet. You can call the left, right, top, and bottom bounds but that values is totally dependent on the current view. In a 3D view the values are meaningless. BUT - Data Tags can access that information. And I can't find a way to pull that information into a worksheet. Bounding Area.vwx
  2. Glad it worked. I don't use IFC data and I always get confused with roof planes because they are classified as slabs.
  3. 🤣 If I ever get an event aware tool to work I'll try it out!
  4. See if this does what you need. The trick is to 1) switch the database criteria to include only slabs or roof faces 2) change the GetIFCProperty call. If you edit the style slab or wall or roof style then click on the IFC… button you can see the values to type into the GetIFCProperty( ). The wall type, slab type, and roof type and roof type need to be assigned. By default they will all be xx-1. To edit that you can edit the wall/slab/roof style, click on the Data tab and edit the information in the Mark and Description fields. This is probably as clear as mud. Post back if you still have questions. Wall Type Schedule~.vwx
  5. What should happen if I use vstEnableMode(1,FALSE); ? I'm trying to make a parametric object not use the first mode. Object is not Event Aware. Does it need to be to use vstEnableMode?
  6. Yep. I even made unique handle variables. I started by drawing two solids and subtracting them and then exporting the script, just to make sure I was doing it right. SubtractSolid(bigObject,smallObject,subtractedObject) returns 20. (Bad input). I'm now trying to work around the subtraction. If it doesn't work I'll go back and get the subtraction code and post it.
  7. What does "Bad Input" mean as a return for a subtract solid? I'm trying to subtract solids in a parametric object. If I ungroup the parametric object and subtract the solids they work fine. But in the script they return 20. Any ideas?
  8. There's a link for Download Plug-in and Example File at the top of the page.
  9. Vectorworks can import and export .dwg directly. If it fits your workflow VW can also import IFC, Revit, Cinema 4D, PDFs, Shapefiles, .3ds, .obj, .stl, Rhino, Parasolid, and Sketchup, plus a few more and export PDF, Shapefile, .3ds, 3D PDF, Cinema 4D, .obj, .stl, Rhino, Parasolid, plus a few more. When round tripping dwg to vwx it will be useful to experiment with the import/export dwg settings to make sure you are getting back the dwg formatting you like.
  10. This sounds interesting! Not sure what that code looks like. GetEvent(?) vsoGetEventInfo(x,y)? Wow. That is not an overwhelming amount of documentation. 😁
  11. This is a really basic question: I've noticed while debugging a rectangular parametric objet that the script runs 2 or 3 times then creates the object. Should I be stopping the 2nd and 3rd running of the script? Why is it doing this? In this example I have a solid subtraction that is failing. When run in the first mode (draw the center line first) it runs but doesn't subtract. When run in the second mode (1 edge first) it loops forever. Taking out the solid subtraction fixes the loop. Running the exact same code as a script works. The solid subtraction succeeds. Is there something about solid subtractions that isn't obvious? Can't get the integer result of the solid subtraction because the program hangs.
  12. Sure. You can attach it here.
  13. So funny you should say that. I've been wondering what the difference is between vsoInsertWidget and vsoAddWidget. So I tried it out. There must be a setting somewhere I don't quite get yet. Procedure Test; {Badly Scripted by Michael Klaers.} CONST kCR = CHR(13); kObjOnInitXProperties = 5; kObjOnWidgetPrep = 41; kObjOnAddState = 44; kObjOnObjectUIButtonHit = 35; kResetEventID = 3; kObjXPropHasUIOverride = 8; kParametricEnableStateEventing = 590; kObjXPropAcceptStates = 18; ButtonID_1 = 9001; kWidgetLongInt = 1; kWidgetBoolean = 2; kWidgetReal = 3; kWidgetText = 4; kWidgetCalculation = 5; kWidgetHandle = 6; kWidgetCoordDisp = 7; kWidgetPopUp = 8; kWidgetRadio = 9; kWidgetCoordLocX = 10; kWidgetCoordLocY = 11; kWidgetButton = 12; kWidgetStaticText = 13; kWidgetStaticTextParam = 14; kWidgetDisclosure = 14; {not implemented?} kWidgetDimStdPopUp = 16; kWidgetPrecisionPopUp = 17; kWidgetClassesPopup = 18; kWidgetLayersPopup = 19; kWidgetAngleDisp = 20; kWidgetAreaDisp = 21; kWidgetVolumeDisp = 22; kWidgetSeparator = 100; kWidgetSubSelection = 101; kWidgetBoundPopup = 102; kWidgetBoundOffset = 103; kWidgetSliderWithEdit = 104; kWidgetButtonResourcePopup= 105; kWidgetBoxPosition = 106; kWidgetResourcePopup = 107; kWidgetSearchablePopup = 108; kDeadData = 0; VAR PIHan, PIRecHan, PIWallHan : HANDLE; resultStatus, result : BOOLEAN; PIName : STRING; eventMessage,theEvent : LONGINT; {---------------------------------------------------------------------} PROCEDURE InitPIO; BEGIN {This tells VW to let the object decide what goes onto the Object Info palette.} result:= SetObjPropVS(kObjXPropHasUIOverride, TRUE); result := SetObjPropVS(12, TRUE); {kObjXHasCustomWidgetVisibilities} SetPrefInt(kParametricEnableStateEventing, 1 ); result := SetObjPropVS(kObjXPropAcceptStates, TRUE); {Now we manually add the "normal" parameters...} {One way is to use this single call to add all of the existing parameters.} {result:= vsoInsertAllParams;} result := vsoInsertWidget(1,kWidgetCoordDisp,1,'',kDeadData); result := vsoInsertWidget(2,kWidgetCoordDisp,2,'',kDeadData); result := vsoInsertWidget(3,kWidgetCoordDisp,3,'',kDeadData); vsoWidgetSetIndLvl(3,1); result := vsoInsertWidget(4,kWidgetSeparator,0,'',kDeadData); result := vsoInsertWidget(5,kWidgetText,4,'',kDeadData); {Finally, we add the button.} result:= vsoAppendWidget(kWidgetButton, ButtonID_1, 'Do Something', 1); END; {---------------------------------------------------------------------} PROCEDURE WidgetPrep; BEGIN vsoSetEventResult( -8 {kObjectEventHandled} ); END; {---------------------------------------------------------------------} PROCEDURE GetStateChange; BEGIN eventMessage := vsoStateAddCurrent(PIHan, eventMessage); END; {---------------------------------------------------------------------} PROCEDURE ButtonHandler; BEGIN CASE eventMessage OF ButtonID_1: BEGIN Message('Stop Pressing That Button'); Sysbeep; Wait(3); ClrMessage; END; END; {CASE} END; {---------------------------------------------------------------------} PROCEDURE Main; BEGIN BeginXtrd(0,pExtrusion); RectangleN(0, 0, 1, 0, pWidth, pHeight); EndXtrd; {Message( 'pWidth: ',pWidth,kCR, 'pHeight: ',pHeight,kCR, 'pExtrusion: ',pExtrusion ); } END; {---------------------------------------------------------------------} BEGIN resultStatus := GetCustomObjectInfo(PIName, PIHan, PIRecHan, PIWallHan); vsoGetEventInfo(theEvent, eventMessage); CASE theEvent OF {User has single-clicked the object's icon.} kObjOnInitXProperties: InitPIO; kObjOnWidgetPrep: WidgetPrep; kObjOnAddState: GetStateChange; {User has clicked a button in the Object Info palette.} kObjOnObjectUIButtonHit: ButtonHandler; {Object reset has been called.} kResetEventID: Main; END; {Event case} END; RUN(Test);
  14. Starting the longer conversation: From experimenting with vsoAddWidget(#,kWidgetType,locName); I'm assuming that the number in the first argument is the number of the parameter in the definition. But the values aren't appearing in the OIP. Is there a different SetObjPropVS that is needed when using only vsoAddWidget? Widget type makes sense. If I use '' as the locName it inserts nothing and a colon. I thought from the function reference that if locName is '' then it uses the alternate name of the parameter? It seems like some changes in the OIP don't take effect until I open a new document. Is there a way to "reset" the OIP in the current document? Procedure Test; {Badly Scripted by Michael Klaers.} CONST kCR = CHR(13); kObjOnInitXProperties = 5; kObjOnWidgetPrep = 41; kObjOnAddState = 44; kObjOnObjectUIButtonHit = 35; kResetEventID = 3; kObjXPropHasUIOverride = 8; kParametricEnableStateEventing = 590; kObjXPropAcceptStates = 18; ButtonID_1 = 9001; kFieldLongInt = 1; kFieldBoolean = 2; kFieldReal = 3; kFieldText = 4; kFieldCalculation = 5; kFieldHandle = 6; kFieldCoordDisp = 7; {dimension} kFieldPopUp = 8; kFieldRadio = 9; kFieldCoordLocX = 10; kFieldCoordLocY = 11; kWidgetButton = 12; kWidgetStaticText = 13; kWidgetDisclosure = 14; {not implemented?} VAR PIHan, PIRecHan, PIWallHan : HANDLE; resultStatus, result : BOOLEAN; PIName : STRING; eventMessage,theEvent : LONGINT; {---------------------------------------------------------------------} PROCEDURE InitPIO; BEGIN {This tells VW to let the object decide what goes onto the Object Info palette.} result:= SetObjPropVS(kObjXPropHasUIOverride, TRUE); result := SetObjPropVS(12, TRUE); {kObjXHasCustomWidgetVisibilities} SetPrefInt(kParametricEnableStateEventing, 1 ); result := SetObjPropVS(kObjXPropAcceptStates, TRUE); {Now we manually add the "normal" parameters...} {One way is to use this single call to add all of the existing parameters.} {result:= vsoInsertAllParams;} result := vsoAddWidget(1,kFieldCoordDisp,'Blah Width'); result := vsoAddWidget(2,kFieldCoordDisp,'Blah Height'); result := vsoAddWidget(3,kFieldCoordDisp,'Blah Extrusion'); result := vsoAddWidget(1,kFieldText,''); {Finally, we add the button.} result:= vsoAppendWidget(kWidgetButton, ButtonID_1, 'Do Something', 1); END; {---------------------------------------------------------------------} PROCEDURE WidgetPrep; BEGIN vsoSetEventResult( -8 {kObjectEventHandled} ); END; {---------------------------------------------------------------------} PROCEDURE GetStateChange; BEGIN eventMessage := vsoStateAddCurrent(PIHan, eventMessage); END; {---------------------------------------------------------------------} PROCEDURE ButtonHandler; BEGIN CASE eventMessage OF ButtonID_1: BEGIN Message('Stop Pressing That Button'); Sysbeep; Wait(3); ClrMessage; END; END; {CASE} END; {---------------------------------------------------------------------} PROCEDURE Main; BEGIN BeginXtrd(0,pExtrusion); RectangleN(0, 0, 1, 0, pWidth, pHeight); EndXtrd; {Message( 'pWidth: ',pWidth,kCR, 'pHeight: ',pHeight,kCR, 'pExtrusion: ',pExtrusion ); } END; {---------------------------------------------------------------------} BEGIN resultStatus := GetCustomObjectInfo(PIName, PIHan, PIRecHan, PIWallHan); vsoGetEventInfo(theEvent, eventMessage); CASE theEvent OF {User has single-clicked the object's icon.} kObjOnInitXProperties: InitPIO; kObjOnWidgetPrep: WidgetPrep; kObjOnAddState: GetStateChange; {User has clicked a button in the Object Info palette.} kObjOnObjectUIButtonHit: ButtonHandler; {Object reset has been called.} kResetEventID: Main; END; {Event case} END; RUN(Test);
  15. Thanks, Josh. A higher number for the button id fixed it.
  16. It's making more sense. The main part of the program is now PROCEDURE Main; I've made a little progress. I got it to compile, but not do anything different than it was doing with FAR few lines of code. 🤣 Here are my next questions: result:= vsoAppendWidget(kWidgetButton, ButtonID_1, 'Do Something', 0); kWidgetButton is 12 Is the next argument for the Button ID any LONGINT or does it refer to the place it occupies in the OIP? The string is the button label. What is the last argument? The example code in the function reference has it set to 0. Changing it to other values I tried didn't make a difference. In any case, the script below produces no button. ******************************* eventMessage := vsoStateAddCurrent(PIHan, eventMessage); What does this do? Not sure what the LONGINTs for vsoGetInfo(theEvent, eventMessage); refer to. ******************************* Thanks for all your help. I was NOT expecting to have compiled code tonight! This runs. But no button. Procedure Test; {Badly Scripted by Michael Klaers.} CONST kCR = CHR(13); kObjOnInitXProperties = 5; kObjOnWidgetPrep = 41; kObjOnAddState = 44; kObjOnObjectUIButtonHit = 35; kResetEventID = 3; kObjXPropHasUIOverride = 8; kParametricEnableStateEventing = 590; kObjXPropAcceptStates = 18; kWidgetButton = 12; ButtonID_1 = 1; VAR PIHan, PIRecHan, PIWallHan : HANDLE; resultStatus, result : BOOLEAN; PIName : STRING; eventMessage,theEvent : LONGINT; {---------------------------------------------------------------------} PROCEDURE InitPIO; BEGIN {This tells VW to let the object decide what goes onto the Object Info palette.} result:= SetObjPropVS(kObjXPropHasUIOverride, TRUE); result := SetObjPropVS(12, TRUE); {kObjXHasCustomWidgetVisibilities} SetPrefInt(kParametricEnableStateEventing, 1 ); result := SetObjPropVS(kObjXPropAcceptStates, TRUE); {Now we manually add the "normal" parameters...} {One way is to use this single call to add all of the existing parameters.} result:= vsoInsertAllParams; {Finally, we add the button.} result:= vsoAppendWidget(kWidgetButton, ButtonID_1, 'Do Something', 1); END; {---------------------------------------------------------------------} PROCEDURE WidgetPrep; BEGIN vsoSetEventResult( -8 {kObjectEventHandled} ); END; {---------------------------------------------------------------------} PROCEDURE GetStateChange; BEGIN eventMessage := vsoStateAddCurrent(PIHan, eventMessage); END; {---------------------------------------------------------------------} PROCEDURE ButtonHandler; BEGIN CASE eventMessage OF ButtonID_1: BEGIN END; END; {CASE} END; {---------------------------------------------------------------------} PROCEDURE Main; BEGIN BeginXtrd(0,pExtrusion); RectangleN(0, 0, 1, 0, pWidth, pHeight); EndXtrd; {Message( 'pWidth: ',pWidth,kCR, 'pHeight: ',pHeight,kCR, 'pExtrusion: ',pExtrusion ); } END; {---------------------------------------------------------------------} BEGIN resultStatus := GetCustomObjectInfo(PIName, PIHan, PIRecHan, PIWallHan); vsoGetEventInfo(theEvent, eventMessage); CASE theEvent OF {User has single-clicked the object's icon.} kObjOnInitXProperties: InitPIO; kObjOnWidgetPrep: WidgetPrep; kObjOnAddState: GetStateChange; {User has clicked a button in the Object Info palette.} kObjOnObjectUIButtonHit: ButtonHandler; {Object reset has been called.} kResetEventID: Main; END; {Event case} END; RUN(Test); PS. why are the tab stops all messed up when I copy/paste code?
  17. Thanks everyone for your help. Although it's hurting my head. Do I understand correctly that the handling of the control geometry - GetCustomObjectInfo - is now moved outside the main part of the program (which is where I've always been doing it) to after the main program. Josh, in your example, the code that contains GetCustomObjectInfo and calls all the procedures - InitPrep, WidgetPrep, GetStateChange, etc - isn't in a Procedure. It's just a Begin & End after the main part of the program. Is there syntax missing? Or does the program just have two Begins and two Ends?
  18. I always considered the SDK label like a green "Mr. Yuck" sticker that parents used to put on poisonous household chemicals. Meant to keep kids away from Drano and me away from more coding that I couldn't handle. 😀
  19. Your ears should be burning! OK. I'm going to go sit quietly in a corner and think about my choices in life. Is it safe to assume that kObjOnWidgetPrep and the other k____ values are constant integer values and they might be listed in an appendix? Thanks! MK
  20. michaelk

    VW 3-D

    2013 may be before the switch in solid engines in Vectorworks. And it's almost certainly before new solid types like subdivisions and tools like the push/pull tool. Take a look at this: https://university.vectorworks.net
  21. Oy vey. Thanks for doing this. I’m really looking forward to trying to climb up to the next plateau. Is there a point at which all the undocumented arcane knowledge has been encountered and you are limited only by your limited coding talent?
  22. This is going to be fun. Or overwhelming.
  23. Wow. Thanks Sam. I can't wait to stare into the face of event awareness. My next question was going to be if anyone had a "Hello World" event aware example. 😀
  24. Somewhere, at some time in the past, I ran across an example script showing how to format OIPs. I'm interested in grouping parameters and maybe adding buttons. I don't see it at https://developer.vectorworks.net. Was I dreaming?

 

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.

×
×
  • Create New...