Jump to content

_c_

Member
  • Posts

    2,434
  • Joined

  • Last visited

Reputation

1,258 Spectacular

Personal Information

  • Occupation
    BIM Manager at &MICA
  • Homepage
    www.cad-bim-manager.com
  • Hobbies
    scripting
  • Location
    Germany

Recent Profile Visitors

6,076 profile views
  1. I worked with Microstation, Allplan, Revit, Vectorworks and am now on Archicad. Ask me which one I would suggest you to invest your money on.
  2. This path of licensing scheme began long ago. You are where you are, people, because you accepted this and still do. "But what can I do". Sell now, that's what you can do. Better now than later. Vectorworks is not developing for us, it develops exclusively for its own marketing. "Features" tailored to show off on a list, never really working. Decades of complaints ignored. My warning to potential new users, the problem is not the licence system, as ugly and exploitative as it is. The problem is that the application doesn't actually develop for our needs and, but with major workarounds, nothing really works as you need. _c_ User since Minicad who sold and moved on. Never looked back.
  3. Dear Raymond, please don't share the webarchives, it includes tons of bad links from Wikispammers. I didn't check this very one, but it might be the case as well. Delete the attachment, please. Hello @MarcelP102, I did add the Events article to the dev already some time ago, did you check this? https://developer.vectorworks.net/index.php/VS:Object_Events
  4. Ciao @Gregi, You can do your own dialog for the Plug-in style, this is fairly easy, you place the call into the event OBJONEDITPLUGINSTYLE (60). I never tried to add a custom button to the standard style pop-up only. You must see the whole sequence: In order to fetch the PIO style, you need a PIO handle, but the event 5 (init properties), where you create the button, runs when the Pio handle is NIL. Whereby the question arises of WHEN and WHEREFROM that Plug-in Object Style palette fetches the parameters, since it doesn't seem to run through event 5. It shows the button as needed, so it must pick the stuff loaded in the code for event 5 somehow. If you select an object instance on drawing (PIO H != NIL) and click on "Edit Style" in its OIP, you'll raise the events' sequence 65 > 60 before the standard Plug-in Object Style dialog to appear. No event 5. See screenshot below, the button appears as it would be in the OIP, but there was no event 5 loaded (or detected). That is, I don't know how to show that button ONLY on style edit events. Below a few useful observations about returned events when working with styles (this is an oldish list, there might be more now): OIP selection Events: choose "New Plug-in Style from..." : 65: kObjStyleWidgetChosen the "save sym in folder" dialog appears 61: kObjCreatePluginStyle 63: kObjFinalizeCreateStyle 60: kObjEditPluginStyle 62: kObjUpdatePluginStyleObject 64: kObjFinalizeUpdateStyledObject choose "Edit Style" : 65: kObjStyleWidgetChosen 60: kObjEditPluginStyle 62: kObjUpdatePluginStyleObject 64: kObjFinalizeUpdateStyledObject choose "Replace" : 65: kObjStyleWidgetChosen 60: kObjEditPluginStyle 62: kObjUpdatePluginStyleObject 64: kObjFinalizeUpdateStyledObject choose Convert to Unstyled: 65: kObjStyleWidgetChosen the "choose a Plug-in Style" dialog appears 75: kObjValidateReplacePluginStyle 62: kObjUpdatePluginStyleObject 64: kObjFinalizeUpdateStyledObject contextual menu: 60: kObjEditPluginStyle 62: kObjUpdatePluginStyleObject 64: kObjFinalizeUpdateStyledObject BTW, I wouldn't set view at each regen of a PIO, a PIO has its own environment. You can coerce the Pio to regen on Top plan only in the Plug-in Properties, set "Projection" to "requires 2D" If you need to create 3D geometry from within, you might want to use vs.SetPlanarRefIDToGround on the 2D source shape, convert to NURBS or whatever, then turn it around in 3D as needed. if source2DShape != vs.Handle(0): vs.SetPlanarRefIDToGround(sourceShape) nurbsCurve = vs.ConvertToNURBS(sourceShape, False) Example of style access with alerts testing the events : def execute(): ## Uncomment the following to run this code in debug mode ## For more information refer to: http://developer.vectorworks.net/index.php/Python_Debugging #import pydevd #pydevd.settrace(suspend = False) global gPio_N, gPio_H, gPioRec_H, gWall_H, gPioPoly, gPioStyleN, gPioStyleH empty = 0 gCnt = 0 (ok, gPio_N, gPio_H, gPioRec_H, gWall_H) = vs.GetCustomObjectInfo() (theEvent, messageNr) = vs.vsoGetEventInfo() vs.AlrtDialog(f"{theEvent}") # just test events # test style access, you need the object var not to be NIL in order to fetch the style if gPio_H != vs.Handle(0): gPioStyleN = vs.GetPluginStyle(gPio_H) gPioStyleH = vs.GetObject(gPioStyleN) vs.AlrtDialog(f"{theEvent}\n{gPioStyleN}\n{gPioStyleH}\n{gPio_H}\n{gPioRec_H}") # 5: the PIO might have extended props, runs BEFORE kParametricRecalculate # here is where you add buttons, but here the object variable gPio_H is NIL! if theEvent == ke.OBJONINITXPROPERTIES: vs.SetPrefInt(590, 1) # enable eventing for this plug-in ok = vs.SetObjPropVS(ke.OBJXPROPREDSYMBOLISSTYLE, True) # Red Symbol of this object can be used to drag drop over existing instances to copy the attributes ok = vs.SetObjPropVS(ke.OBJXSUPPORTSSTYLES, True) # adds the Plug-in Style menu in the OIP and contextual menu ok = vs.SetObjPropVS(ke.OBJXPROPHASUIOVERRIDE, True) ok = vs.SetObjPropCharVS(ke.WIDGETGROUPMODE, vs.Chr(ke.WIDGETGROUPAUTOMATIC)) # uses widget groups ok = vs.vsoInsertAllParams() ok = vs.vsoAppendWidget(ke.WIDGETBUTTON, BUT_TEST, 'MyStyleButton...', empty) # event 3: regen elif theEvent == ke.PARAMETRICRECALCULATE: main() vs.vsoStateClear(gPio_H) # event 60, also on edit in res manager elif theEvent == ke.OBJONEDITPLUGINSTYLE: # enable a custom style dialog # if vs.GetCustomObjectInfo(gPio_N, gPioStyleH, gPioRec_H, temp_h) and (gPioStyleH != vs.Handle(0)): # MyCustomPIOStyleDialog(gPioStyleH) vs.vsoSetEventResult(ke.OBJEDITPLUGINSTYLEBYDEFAULT) # -10 # event 41, after selecting an obj, for building its OIP: set widget visib., enablem., fields elif theEvent == ke.OBJONWIDGETPREP: vs.vsoSetEventResult(ke.OBJECTEVENTHANDLED) elif theEvent == ke.OBJONOBJECTUIBUTTONHIT: if gPio_H != vs.Handle(0): someCode()
  5. Thank you Julian, I think we need that number back. It didn't hurt in the least and there was no reason to drop it.
  6. In case you didn't notice, round walls don't respond any longer to the flag 89. Now they are all object type 68. All your scripts relying on objectType =89 are broken. Similarly, in Worksheets you cannot restrict your criteria to T=89 or ROUNDWALL. Searching for some sort of identifier I found this approach with GetArc, do you have any better? GetVersionEx(major, minor, maintenance, platf, build); vwVersion := Str2num(Concat(major, minor, maintenance)); {...} IF vwVersion < 2700 THEN isRoundWall := (GetTypeN(wallHandle) = 89) ELSE BEGIN GetArc(wallHandle, startAng, endAng); isRoundWall := (startAng + endAng <> 0); END;
  7. @Pat Stanford you are correct, it is not in the site-packages folder, it is in pyhton3.9 I am still not in clear about all path nuances between python/VW/editor, so can't really tell if it's wrong.
  8. It's there. I don't understand what is going on, I file now a report and hopefully @K.Lalkovski can get a look into that. Edit: no, decided not to file a report. Tkinter is not working easily anywhere, particularly on Mac, and there is even the limit of it being somehow commercial.
  9. I tried using tkinter just recently and it stalls VW indefinitely, simply upon loading the import, does anyone see this?
  10. I noticed that my old subroutine for parsing the 3D state of an object wasn't reliable any longer. There are various object flags in the SDK (/SDKLib/Include/Kernel/API/ObjectVariables.h) that allow to parse the multiple flavours of objects' 2D-ness . Surprisingly, though, a layer plane object doesn't resolve as 2D. For me a rectangle, as primitive shape, is a 2D object, be it screen or layerPlane. And for a multitude of Vectorscript tasks this is what we need to know. In this file you can experiment with the various flags: test is3D.vwx Example: a layer plane object surprisingly resolves as 3D with the flag 651: Example: a 3D plane object is not really 2D for us but surprisingly resolves as planar with the flag 1161: (and let's not speak about the surreal fact that this object floats in space without giving a z value in the OIP, a reason for confusion for the user) Thus: { *********************************************** } { checks if h is 3D obj, doesn't check NIL status } FUNCTION H_Is3D(h: HANDLE): BOOLEAN; BEGIN H_Is3D := (GetObjectVariableBoolean(h, 1160) = FALSE) AND (GetObjectVariableBoolean(h, 1162) = FALSE); { isScreen and isLayerPlane both false } END; or in Python def o_is3D(h): """checks if h is 3D obj, doesn't check NIL status""" return ((vs.GetObjectVariableBoolean(h, 1160) == False) and (vs.GetObjectVariableBoolean(h, 1162) == False)) # isScreen and is LayerPlane are both false Try this on any selection: import vs h = vs.FSActLayer() if h == vs.Handle(0): vs.AlrtDialog('Select something') else: isScreen = vs.GetObjectVariableBoolean(h, 1160) # obj is screen isPlanar = vs.GetObjectVariableBoolean(h, 1161) # obj is planar isLayerPlane = vs.GetObjectVariableBoolean(h, 1162) # obj is in layer plane isHybrid = vs.GetObjectVariableBoolean(h, 1163) # obj is hybrid is3D = vs.GetObjectVariableBoolean(h, 650) # obj is 3D is2D = vs.GetObjectVariableBoolean(h, 651) # obj is 2D vs.AlrtDialog(f"screen: {isScreen}\nisPlanar: {isPlanar}\nlayerPlane: {isLayerPlane}\nhybrid: {isHybrid}\nis2D: {is2D}\nis3D: {is3D}")
  11. Hello, I am working on a brute force Pascal <> Python converter. This won't actually be much, but will provide a way to resolve the conversion of whole libraries. Not everything can be fixed though, and a lot of fixes still remain for making the code run properly. And let's not speak about optimising for Python.
×
×
  • Create New...