Jump to content

Recommended Posts

JoanM

Hi, I'm trying to get the element count of each path array in a drawing that has a lot of them and export these values to a file.

First I tried to do it through data extraction, but aparently the data extraction wizard doesn't allow to extract data from path arrays (or I have not been able to do so).

So I turned to a lisp based solution. However I can't figure out how to get it. I expected to see that parameter (number of elements in a path array) as an entity code, but none of these looks like the object count of the path array nor path length or element spacing (which would allow to calculate the element count). I attach an example of the codes I get for a path array having 28 elements (path length 340,2 and element spacing 12,6):

 

  (
    (-1 . <Entity name: 28777fee5f0>)
    (0 . "INSERT")
    (5 . "3362F")
    (102 . "{ACAD_REACTORS")
    (330 . <Entity name: 287073a1d50>)
    (102 . "}")
    (330 . <Entity name: 287774819f0>)
    (100 . "AcDbEntity")
    (67 . 0)
    (410 . "Model")
    (8 . "HOLES_LAYER")
    (100 . "AcDbBlockReference")
    (2 . "*U110")
    (10 0.0 10000.0 0.0)
    (41 . 1.0)
    (42 . 1.0)
    (43 . 1.0)
    (50 . 0.0)
    (70 . 0)
    (71 . 0)
    (44 . 0.0)
    (45 . 0.0)
    (210 0.0 0.0 1.0)
  ) 

 

I appreciate any help.

Share this post


Link to post
Share on other sites
Tharwat

You need to dig into the entity 330 two times as far as I remember to reach the gems in the bottom of the ocean. :) 

 

  • Like 1

Share this post


Link to post
Share on other sites
BIGAL
Posted (edited)

Had a go getting somewhere yes its deep.

 

(entget (cdr (assoc 330 (entget (cdr (assoc 330 (entget (car (entsel)))))))))

Note column spacing appears to be Itemspacing.


Select entity: ((-1 . <Entity name: 2d82adc0>) (0 . "ACDBASSOCACTION") (5 . "A9") (330 . <Entity name: 2d827f80>) (100 . "AcDbAssocAction") (90 . 2) (90 . 0) (330 . <Entity name: 2d827f80>) (360 . <Entity name: 2d82a4c0>) (90 . 1) (90 . 3) (90 . 3) (360 . <Entity name: 2d82bcc0>) (360 . <Entity name: 2d82bec0>) (360 . <Entity name: 2d8302c0>) (90 . 0) (90 . 4) (360 . <Entity name: 2d82c040>) (360 . <Entity name: 2d82ba00>) (360 . <Entity name: 2d82ba40>) (360 . <Entity name: 2d82b2c0>) (90 . 0) (90 . 8) (90 . 0) (1 . "ItemSpacing") (90 . 1) (90 . 1) (40 . 229.981266980154) (90 . 0) (1 . "RowSpacing") (90 . 1) (90 . 1) (40 . 147.097303980063) (90 . 0) (1 . "LevelSpacing") (90 . 1) (90 . 1) (40 . 1.0) (90 . 0) (1 . "Items") (90 . 0) (90 . 1) (90 . 4) (90 . 0) (1 . "Rows") (90 . 0) (90 . 1) (90 . 3) (90 . 0) (1 . "Levels") (90 . 0) (90 . 1) (90 . 1) (90 . 0) (1 . "RowElevation") (90 . 1) (90 . 1) (40 . 0.0) (90 . 0) (1 . "AxesAngle") (90 . 2) (90 . 1) (40 . 1.5707963267949))
Auto saving open drawings... D:\Acadtemp\Drawing1_6167.SV$

Edited by BIGAL

Share this post


Link to post
Share on other sites
JoanM

Thank you Tharwat and specially BIGAL, who offered a specific sentence and an always valuable example.

 

Anyway I wonder where is that tree digging explained. After your suggestion I've reread my DXF reference manual and I haven't been able to find a hint about this. The pdf I looked up though (I realize this now) is Autocat 2012 edition, whereas I am working with Autocad 2020. May be that's why...

Share this post


Link to post
Share on other sites
Tharwat

The codes posted above is the one that I was referring to, and the 'tree' expression that you used is related to the DXF entities within each entity that you need to dig into to step through to reach it, so just give the codes a try to see the result on the command line right after you select dynamic array object.

 

If you aren't able to see the aimed result then upload a sample drawing with your tested object to check that out for you if time serves.

Share this post


Link to post
Share on other sites
JoanM

Thank you for your offer, Tharwat, but thanks to your suggestion I was able to find what I was looking for. I appreciate your interest.

 

My only concern was about documentation where this subject is described. I don't think we, as Autocad users, especially beginners, should explore the DXF entities in a let's say trial and error process to find what one is looking for. I would rather expect to find it in some documentation manual.

 

Anyway, the problem where I got stuck is solved now. I hope to hear from you at the next one 😉.

Share this post


Link to post
Share on other sites
Tharwat

You're welcome anytime. :)

 

For more info or for deeper dives into entities / objects , just entget any object and take the DXF group codes and read about them in the DXF documentation side by side with practicing more and more.

 

Best of luck.

 

Share this post


Link to post
Share on other sites
BIGAL

This intrigued me a bit so had a go a bit further a bit rough but seems to work. 

 

; (1 . "ItemSpacing") (90 . 1) (90 . 1) (40 . 161.77) (330 . <Entity name: 0>) (330 . <Entity name: 0>) (90 . 0) 
; (1 . "Items") (90 . 0) (90 . 1) (90 . 4) (330 . <Entity name: 0>) (330 . <Entity name: 0>) (90 . 0) 
; (1 . "LevelSpacing") (90 . 1) (90 . 1) (40 . 2.05997) (330 . <Entity name: 0>) (330 . <Entity name: 0>) (90 . 0) 
; (1 . "Levels") (90 . 0) (90 . 1) (90 . 1) (330 . <Entity name: 0>) (330 . <Entity name: 0>) (90 . 0) 
; (1 . "RowElevation") (90 . 1) (90 . 1) (40 . 0.0) (330 . <Entity name: 0>) (330 . <Entity name: 0>) (90 . 0)  
; (1 . "RowSpacing") (90 . 1) (90 . 1) (40 . 161.77) (330 . <Entity name: 0>) (330 . <Entity name: 0>) (90 . 0) 
; (1 . "Rows") (90 . 0) (90 . 1) (90 . 5) (330 . <Entity name: 0>) (330 . <Entity name: 0>))

(setq ent (entget (cdr (assoc 330 (entget (cdr (assoc 330 (entget (car (entsel))))))))))
(setq lst '("Items" "Rows"))
(setq  lst2 '())
(foreach obj lst
(setq x 0)
(foreach val ent
(if (and (= (car val) 1)(= (cdr val) obj))
(setq lst2 (cons (cdr (nth (+ x 3) ent)) lst2))
)
(setq x (+ x 1))
)
)

(alert (strcat "total number of items is " (rtos (* (nth 0 lst2)(nth 1 lst2)) 2 0)))

 

Share this post


Link to post
Share on other sites
JoanM

You being intrigued about the subject I asked about makes me feel better and think that it was not so obvious.

Thanks a lot for your contribution, Bigal.

Share this post


Link to post
Share on other sites
BIGAL

No worries I am sure it could be done better.

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...