Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

entget change in 2013?

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
angiegauthier
712 Views, 11 Replies

entget change in 2013?

Hi Everyone,

 

This section of code works in Autocad 2008, but no longer works in Autocad 2013. Can anyone tell me why?

 

(setq ifrment (nentselp "Inside Frame" ifrm1))
      (setq ifrmprop (entget (car ifrment)))
      (setq ifrm_width (abs (- (cadr (nth 38 ifrmprop)) (cadr (nth 42 ifrmprop)))))
      (setq ifrm_height (abs (- (caddr (nth 22 ifrmprop))(caddr (nth 38 ifrmprop)))))

 Angie

11 REPLIES 11
Message 2 of 12
_Tharwat
in reply to: angiegauthier

What is the object that you are trying to retrieve form the entget function ?

Message 3 of 12
angiegauthier
in reply to: _Tharwat

I'm trying to get some points of a polyline and then use them to calculate the width and height of the object drawn. Have the group codes changed? I get a different results in autocad 2013 than I did in previous versions of these (nth 38 ifrmprop) Does that make sense?

 

Angie

Message 4 of 12
_Tharwat
in reply to: angiegauthier

Actually you have two mistakes .

1- Use entsel function instead of nentselp function

2- You are using nth function with 38 and I think it returns nil since that all the groups of DXF codes won't

reach that number , you may mean (cdr (assoc 38 ifrmprop))

 

Change they and tell me back

Message 5 of 12
angiegauthier
in reply to: _Tharwat

That doesn't seem to work either. And if it was an error, why did it work in previous versions of ACAD?

 

This is what I tried. Maybe I didn't change it correctly?

(setq ifrment (entsel ifrm1))
      (setq ifrmprop (entget (car ifrment)))
      (setq ifrm_width (abs (- (cdr (assoc 38 ifrmprop)) (cdr (assoc 42 ifrmprop)))))
      (setq ifrm_height (abs (- (cdr (assoc 22 ifrmprop))(cdr (assoc 38 ifrmprop)))))

 We've recently upgraded to 2013, and I am finding issues with programs that are not working with this version of Autocad that were working previously. We still have some users on ACAD 2006, so it needs to work for both versions until we can get everyone upgraded.

Message 6 of 12
_Tharwat
in reply to: angiegauthier


@angiegauthier wrote:

(setq ifrment (entsel ifrm1))
  

 


After the function entsel must be string or without .

What is the DXF code 22 refers to ?

Message 7 of 12
Wbaxter
in reply to: _Tharwat

what is the result in 2013 of running just the first two lines?

(setq ifrment (nentselp "Inside Frame" ifrm1))
(setq ifrmprop (entget (car ifrment)))

 

what is the rusult from running the same two lines in the older version?

Message 8 of 12
angiegauthier
in reply to: Wbaxter

Here is a whole pile of results from both versions. When I originally did this, I must have got some outside help, becuase I don't have a good grasp on what's happening.


(setq ifrment (nentselp "Inside Frame" ifrm1))
2013 (<Entity name: 7ffffb10380> (1969.23 2254.78 0.0))
2006 (<Entity name: 7efe0108> (1268.75 2630.35 0.0))

 

(setq ifrmprop (entget (car ifrment)))

2013
((-1 . <Entity name: 7ffffb10380>) (0 . "LWPOLYLINE") (330 . <Entity name: 7ffffb03980>)
(5 . "2CA8") (100 . "AcDbEntity") (67 . 0) (410 . "Model")
(8 . "Inside Frame") (100 . "AcDbPolyline") (90 . 9) (70 . 1) (43 . 0.0) (38 . 0.0)
(39 . 0.0) (10 2371.09 2546.44) (40 . 0.0) (41 . 0.0) (42 . 0.0908401) (91 . 0)
(10 2192.11 2647.39) (40 . 0.0) (41 . 0.0) (42 . 0.0832849) (91 . 0)
(10 1969.23 2684.78) (40 . 0.0) (41 . 0.0) (42 . 0.0832849) (91 . 0)
(10 1746.35 2647.39) (40 . 0.0) (41 . 0.0) (42 . 0.0908401) (91 . 0)
(10 1567.37 2546.44) (40 . 0.0) (41 . 0.0) (42 . 0.104065) (91 . 0)
(10 1444.39 2390.78) (40 . 0.0) (41 . 0.0) (42 . 0.0927808) (91 . 0)
(10 1405.83 2254.78) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0)
(10 2532.63 2254.78) (40 . 0.0) (41 . 0.0) (42 . 0.0927808) (91 . 0)
(10 2494.07 2390.78) (40 . 0.0) (41 . 0.0) (42 . 0.104065) (91 . 0)
(210 0.0 0.0 1.0))

 

2006
((-1 . <Entity name: 7efe0108>) (0 . "LWPOLYLINE") (330 . <Entity name:
7ef6ecc0>) (5 . "2CD9") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
"Inside Frame") (100 . "AcDbPolyline") (90 . 9) (70 . 1) (43 . 0.0) (38 . 0.0)
(39 . 0.0) (10 1670.61 2922.02) (40 . 0.0) (41 . 0.0) (42 . 0.0908401)
(10 1491.63 3022.97) (40 . 0.0) (41 . 0.0) (42 . 0.0832849)
(10 1268.75 3060.35) (40 . 0.0) (41 . 0.0) (42 . 0.0832849)
(10 1045.87 3022.97) (40 . 0.0) (41 . 0.0) (42 . 0.0908401)
(10 866.896 2922.02) (40 . 0.0) (41 . 0.0) (42 . 0.104065)
(10 743.91 2766.36) (40 . 0.0) (41 . 0.0) (42 . 0.0927808)
(10 705.351 2630.35) (40 . 0.0) (41 . 0.0) (42 . 0.0)
(10 1832.16 2630.35) (40 . 0.0) (41 . 0.0) (42 . 0.0927808)
(10 1793.6 2766.36) (40 . 0.0) (41 . 0.0) (42 . 0.104065) (210 0.0 0.0 1.0))

 

(assoc 38 ifrmprop)
2006 (38 . 0.0)
2013 (38 . 0.0)

 

(assoc 42 ifrmprop)
2006 (42 . 0.0908401)
2013 (42 . 0.0908401)

 

(cadr (nth 38 ifrmprop))
2013; error: bad argument type: consp 0
2006 (10 5.64325 2749.45)

 

(cadr (nth 42 ifrmprop));
2013:error: bad argument type: consp 0.0927808
2006:(10 1132.45 2749.45)

Message 9 of 12
Rtogores
in reply to: angiegauthier

What is the current setting for OSMODE and 3DOSMODE?

3DOSMODE was introduced with Release 2011 so your 2008 programs are probably not taking it into account.

Message 10 of 12
Kent1Cooper
in reply to: angiegauthier

See this thread for some explanation about the (91. 0) entries in the 2013 list that are not in the 2006 list:
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/2010-Lwpolyline-group-code-91/m-p/249...

 

That makes the list longer, and means you can't count on a particular vertex's information being in a particular place in the list, at least not the same place under different versions, or maybe just not in the same place for a Polyline drawn under vanilla AutoCAD as for one drawn with an overlay program.

 

You should probably get a list of vertices, either with (vla-get-coordinates) applied to a conversion of it to a VLA object [which will give you an undifferentiated list of coordinate values, which you would probably want to subdivide to separate the information for each vertex], or with something like:

 

(mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) ifrmprop))

 

to get the vertices from all the DXF-10 entries, without their 10 prefixes.  Either way will not be affected by whether there are DXF 91 entries.

 

Then look for (nth something... from the resulting list.

Kent Cooper, AIA
Message 11 of 12
angiegauthier
in reply to: Kent1Cooper

Finally got a chance to try this out and yes, this works.

 

Thanks so much.

 

Angie

Message 12 of 12
Kent1Cooper
in reply to: angiegauthier


@angiegauthier wrote:

Finally got a chance to try this out and yes, this works.

 

Thanks so much.

 

Angie


That's good -- I had forgotten all about this.  Be aware [you may not need this warning, but someone who finds this thread looking for an answer to a similar problem may] that the (mapcar) approach outlined will work for Lightweight Polylines, but not for 2D "heavy" or 3D Polylines, for which you would need to do something else, like the ...get-coordinates... approach, or a series of (entnext) functions.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost