Jump to content

_c_

Member
  • Posts

    2,434
  • Joined

  • Last visited

Posts posted by _c_

  1. 5 hours ago, MullinRJ said:

     

       I tried to attach the file directly to this post, but the forum does not accept the .webarchive file extension. Let me know if the attached ZIP file opens and you can read it. If not, I'll send it to you offline. Are you using a Mac, or a PC?

     

    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

     

     

     

     

    • Like 1
  2. 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()

     

     

    956713257_Screenshot2022-07-09at11_48_53.png.1a2f80eda61e4615140a613b288d469e.png

    • Like 2
  3. 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;

     

     

  4. On 4/29/2022 at 3:36 PM, Jayme McColgan said:

    a down and dirty way is to look at the site-packages folder... 

    /Applications/Vectorworks 2022/Vectorworks 2022.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages

     

    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.

    • Like 1
  5. 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:

     

    1706463048_Screenshot2022-04-05at08_57_44.thumb.png.42c27bee1311a5d4877be07bbabf34a7.png

     

    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)

     

    333143332_Screenshot2022-04-05at08_58_07.thumb.png.b8e8a95c9d797c755c379c13ccf36858.png

     

     

     

    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}")


     

    • Like 2
  6. 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.

  7. Hello,

     

    we are selling our Vectorworks Architect International licences, with hardware dongle, serials covering VW from 2004 (VW 11) to 2021.

    VW 2022 is paid but can only be activated if one is ready to renounce to the dongle.

    The serials are starting from before dongles: Minicad 7.

     

    We are based in Berlin.

     

    Edit:

     

    On wish, we are also selling BIM Management tools and plug-ins for an extra price together with this offer.

    The tools are developed up to VW 2022, the code is not inclusive.

     

    Edit: removed contact data

     

    _c_

     

    2069634849_Screenshot2022-02-13at09_38_18.png.1a94f0999ed2a9b236c39c13b156e988.png

     

×
×
  • Create New...