treaves04 Posted October 23, 2013 Posted October 23, 2013 I have some extended data I need to access in order to filter my MEP electrical devices by style name. I have the style name added as property set data. I need to filter by style name and count how many there are and place that number into a variable where I can then access it with a field in a table. I just do not know how to access this information because it is not listed in the xdata. I know I could use a schedule but I also need to filter by layer because we have multiple house fronts in one file. If I used a schedule it would give me the total in the entire file. Thanks in advance;) Quote
tzframpton Posted October 24, 2013 Posted October 24, 2013 I'm no programmer, but IIRC AutoCAD Architecture and AutoCAD MEP objects use the .NET programming language. This may be the wrong forum as I think it's difficult to acquire information on AEC Objects using AutoLISP and Visual LISP. You might use the Report Post option to notify a moderator to move it to the .NET customization area. Quote
BIGAL Posted October 24, 2013 Posted October 24, 2013 You can get into the civ3d AEC data via VL biggest problem is you must know the variable name that holds the information this is often not what its called. You should be able to get at the mep data but again you need to know what your looking for. this just opens up the AEC database and is version dependant (if ((lambda (vrsn) (cond ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09 ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10 ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11 ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12 ? ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13 ((alert "This version of C3D not supported!")) ) ) (vlax-product-key) ) ; end if condition progn is true (progn (cond (*AeccDoc*) ((setq *AeccDoc* (vlax-get (cond (*AeccApp*) ((setq *AeccApp* (vla-getinterfaceobject (cond (*Acad*) ((setq *Acad* (vlax-get-acad-object))) ) (strcat "AeccXUiLand.AeccApplication." appstr) ) ) ) ) 'ActiveDocument ) ) ) ) ; end main cond ) ; end progn ) ; end if vsrn this is an example of opening the surfaces list (vlax-for j (vlax-get *AeccDoc* 'SurfaceS) (setq lst (cons (cons (vla-get-name j) j) lst)) ) surface styles (vlax-for i (vlax-get *AeccDoc* 'SurfaceStyles) (setq lst (cons (cons (vla-get-name i) i) lst)) ) Quote
treaves04 Posted October 24, 2013 Author Posted October 24, 2013 Thanks that is one gaint step closer than I was. I was hoping someone might know the variable also of the devices. I am going to run through the developer reference some more and see what I can dig up. Quote
treaves04 Posted October 24, 2013 Author Posted October 24, 2013 When I list the object it gives the style reference name. How is the list command getting to the data??? Quote
treaves04 Posted October 24, 2013 Author Posted October 24, 2013 I attached a screen shot of the what all was included in what was returned from the list command on one of the objects. Quote
BIGAL Posted October 24, 2013 Posted October 24, 2013 Try this its dumpit.lsp pick your object it will give a lot more detail it will give variable names etc ;;;===================================================================; ;;; DumpIt ; ;;;-------------------------------------------------------------------; ;;; Dump all methods and properties for selected objects ; ;;;===================================================================; (defun C:DumpIt ( / ent) (while (setq ent (entsel)) (vlax-Dump-Object (vlax-Ename->Vla-Object (car ent)) ) ) (princ) ) Quote
Tyke Posted October 24, 2013 Posted October 24, 2013 When you use the Express Tools to list the XData can you see the information that you want? In VBA the XData is appended to an object using DXF codes and whilst this is simple enough to do you either need to know the XData structure (really the order in wich they appear) or the XData includes a descriptive part that you can use to filter. The DXF codes describe the type of information being attached, a string, integer, real number, etc. I developed a XData Viewer in VBA which lists all of the data on an object, if it would help you. But bear in mind it is just a viewer. Quote
treaves04 Posted October 24, 2013 Author Posted October 24, 2013 The dumpit.lsp worked it was able to pull it out. The information I need is listed under Name (RO) =. I have attached a png so you can see. I need to get the string that is listed there. Is there anyway to get this data by its self? Or will I need to filter for it after I call the dumpit function? Thanks for all the help I was beginning to think it was a lost cause. I have spent countless hours searching and reading trying to find a solution. Now I can see some light at the end of the tunnel (I JUST HOPE ITS NOT A TRAIN) Quote
treaves04 Posted October 24, 2013 Author Posted October 24, 2013 It is all listed beside StyleName = Quote
BIGAL Posted October 24, 2013 Posted October 24, 2013 The code above is for Civ3d in particular the "AeccXUiLand.AeccApplication.18" is what I call the name of the current version of the CIV3d database the number on the end is the Autocad version. You have to open this. When I dump a contour I get these two lines ; Style = # ; StyleName (RO) = "NS 0.1 Contours" You can see the Stylename but the variable to get the value is "SurfaceStyles" so you could basicly use the code as is but with a couple of changes you need to know the MEP database name and the style variable name some match the dump others dont. In your Mep install under samples are there code examples in the version like 2011 they had VBA code that you could read and it had sample programs. Can you post a small dwg Quote
treaves04 Posted October 25, 2013 Author Posted October 25, 2013 I have attached a dwg with 2 devices in there. One is an "EXTERIOR CEILING MOUNT" the other is "EXTERIOR CEILING FAN 52". BIGAL I tried to use the code you provided but I could not get it to work. (probably the operator ) But it makes sense that it should be accessible that way. I just wish I could figure out the logic. ELECTRICALTEST.dwg Quote
BIGAL Posted October 25, 2013 Posted October 25, 2013 We have to get inside the databse for civ3d its AeccXUiLand.AeccApplication.18 etc For your dwg its ????? Anyone help ? I have tried to find some way of looking inside a DWG for Application names Googled etc but can not find anything that works. Quote
treaves04 Posted October 25, 2013 Author Posted October 25, 2013 I have spent countless hours looking to no avail. But there has got to be a way if a visual lisp will dump it then it should be accessible the same way. Quote
treaves04 Posted October 25, 2013 Author Posted October 25, 2013 What about like something below? I am just not sure how to select all entities or just the AecbDevice through visual lisp (???????). I know you can do ssget "x" which will select all of them and I know you can filter the selection also to only grab the AecbDevice. It is just being able to filter the step further. Maybe someone can get the code below to function. (setq acadDocument (vla-get-activedocument (vlax-get-acad-object))) (setq allentities (vla-get-???????? acadDocument)) (setq dwgName (vlax-get-property allentities 'Name)) Quote
BIGAL Posted October 25, 2013 Posted October 25, 2013 Is there anything in help under developer ? In Civ3d there were a number of sample directories containing example code to do stuff like add points to the CIV3d database we still have these on an old pc under version 2011 but can not find in 2013. Still need the parent name it will be something like AeccArchi.AeccApplication.18 Quote
treaves04 Posted October 25, 2013 Author Posted October 25, 2013 There is an AecbElec.arx file. Could that be it? Quote
BIGAL Posted October 27, 2013 Posted October 27, 2013 You can view dvb that is the source for VBA I will try AecbElec.application and see what happens just need a few minutes Quote
treaves04 Posted October 27, 2013 Author Posted October 27, 2013 Ok Thanks. There is also an AecbElecBase.dbx Quote
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.