Kars Keizer Posted October 12, 2020 Share Posted October 12, 2020 An script to find the object type number and name of the selected item, works also when placed in right mouse button menu. _hObject=vs.LSActLayer()#get handle of last selected object _tObject=vs.GetTypeN(_hObject)#get typeindex #_tObject=_hObject.type is also possible _list=["1","Line","Rectangle","Oval","Polygon","Arc","7","Freehand","3D Locus","Text","Group","12","Rounded rectangle","Bitmap Image","Symbol in document","Symbol definition","2D Locus","Worksheet","19","20","Polyline","PICT Image","23","Extrude","3D Polygon","26","27","28","Layer Link","30","Layer","32","33","Sweep ","35","36","37","Multiple extrude","39","Mesh","Mesh vertex","42","43","44","45","46","Record Definition (Format)","Record","Document script (1)","50","Script palette (1)","52","53","54","55","Worksheet container","57","58","59","60","61","62","Dimension","64","65","Hatch definition (1)","67","Wall","69","70","Column, Floor, Roof Face","72","73","74","75","76","77","78","79","80","Light","Roof edge","Roof object","CSG Solid (Addition,Subtraction)","85","Plug-in object","Roof element","88","Round walls","90","91","Symbol folder","Texture","Class definition (1)","Solid (Cone, Sphere, ...)","96","Texture Definition(Material)","98","99","100","101","102","103","104","105","106","107","108","109","110","NURBS Curve","112","NURBS Surface","114","115","116","117","118","Image Fill Definition (1)","Gradient Fill Definition (1)","Fill Space (1)","ViewPort"] vs.AlrtDialog('type no. :',_tObject,'\ntype name :',_list[_tObject-1]) # show type index and type name of selected object in an dialog Quote Link to comment
Jiajing Posted February 24, 2023 Share Posted February 24, 2023 @Kars Keizer Lighting Device and lighting pipe are both showing as 86, which is plug in object, is there a way to identify them seperatly, for instance lighitng device as light, not a plug in object Quote Link to comment
Pat Stanford Posted February 24, 2023 Share Posted February 24, 2023 One way would be to use GetName after you know it is a plugin is to use the name of the parametric record to tell you the object type GetName(GetParametricRecord(Handle to your object)) Quote Link to comment
Jiajing Posted February 24, 2023 Share Posted February 24, 2023 (edited) for lights, I ended up using GetRField(h,"Lighting Device","Device Type"). But GetName can be appplied to other scope. thank you Edited February 24, 2023 by Jiajing Quote Link to comment
Elite Exhibits Posted February 27, 2023 Share Posted February 27, 2023 Kars Keizer ERROR message when I run the script above - Only for VW 2023 ? When you have time - Thanks VW/RW Designer 2020 - iMacPro Peter Quote Link to comment
Jiajing Posted February 27, 2023 Share Posted February 27, 2023 @Elite Exhibits It works on my end. Remember to have import vs; at the top of code. Quote Link to comment
MullinRJ Posted February 28, 2023 Share Posted February 28, 2023 (edited) Peter, Did you select Python Script in the popup menu at the top of the Script Editor? If it's set to VectorScript it will definitely error. Raymond Edited February 28, 2023 by MullinRJ Quote Link to comment
Elite Exhibits Posted April 3, 2023 Share Posted April 3, 2023 Kars / Raymond Thanks - switch to Python & edit out the misc induced in the copy & paste - Works Attached is a VWX file (2020) with a functioning version and items to test it on. Noticed that some items are lumped together - Column Floor & Roof face as an example. It also ID's a Pillar as Column Floor & Roof face ... Thanks again Peter Object Type Finder Script 2020_1.vwx 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.