_c_ Posted April 5, 2022 Share Posted April 5, 2022 (edited) 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}") Edited April 5, 2022 by _c_ 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.