Stefan BMR Posted June 27, 2016 Posted June 27, 2016 OK. I'll give you a hint: you need to use sslength to get the number of objects. (setq n (sslength ss)) Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 Then you can use either (repeat n ... or (while (< i n) ... Quote
ktbjx Posted June 27, 2016 Author Posted June 27, 2016 OK. I'll give you a hint: you need to use sslength to get the number of objects. (setq n (sslength ss)) what is sslength? ans isn't it that the setq ss is the object selected? Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 Next, save each element into a variable, lets say e. (setq e (ssname ss i)) Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 sslength stand for Selection Set Length, and return the number of the objects. Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 In order to make any change on the object, you need to get the DXF structure. Each object in the drawing is stored like this, so it's important to learn about DXF. Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 The variable el is a list which defines the line. It should look like this: ( (-1 . <Entity name: 7ff6db706600>) (0 . "LINE") (330 . <Entity name: 7ff6db7051f0>) (5 . "1E8") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 19.2702 -4.33456 0.0) (11 20.351 -13.4291 0.0) (210 0.0 0.0 1.0) ) Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 Each sublist is formed by the DXF code, which is the first element, -1, 0, 330 etc. Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 The rest is the value of the coresponding DXF code. Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 The geometry of the line is defined by it's start (code 10) and by it's end (code 11) (10 19.2702 -4.33456 0.0) (11 20.351 -13.4291 0.0) Quote
ktbjx Posted June 27, 2016 Author Posted June 27, 2016 The variable el is a list which defines the line. It should look like this: ( (-1 . <Entity name: 7ff6db706600>) (0 . "LINE") (330 . <Entity name: 7ff6db7051f0>) (5 . "1E8") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 19.2702 -4.33456 0.0) (11 20.351 -13.4291 0.0) (210 0.0 0.0 1.0) ) meaning it has to be defined everytime, so it's on the loop?? (while (< i n) (setq e (ssname ss i)) (setq el (entget e)) (-1 . <Entity name: 7ff6db706600>) (0 . "LINE") (330 . <Entity name: 7ff6db7051f0>) (5 . "1E8") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 19.2702 -4.33456 0.0) (11 20.351 -13.4291 0.0) (210 0.0 0.0 1.0) ) Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 So, 10 is DXF code, 19,2702 is the x coordinate, -4.33456 is y and z is 0.0 Quote
ktbjx Posted June 27, 2016 Author Posted June 27, 2016 Are you still with me? yes still figuring how you get the coordinated though??? Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 meaning it has to be defined everytime, so it's on the loop?? (while (< i n) (setq e (ssname ss i)) (setq el (entget e)) e and el will be change, because the index must be increased, so each time another entity is stored on e variable, and each will have a different el definition. Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 To change the start point, you need to redefine the el list. First, store old point and the new point: (setq start_point (assoc 10 el)) (10 19.2702 -4.33456 0.0) The new point will simply get the y value instead of 0.0 (setq new_start_point (list 10 (cadr start_point) (caddr start_point) (caddr start_point))) (10 19.2702 -4.33456 -4.33456) Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 To save the el list with the new values: (setq el (subst new_start_point start_point el)) ( (-1 . <Entity name: 7ff6db706600>) (0 . "LINE") (330 . <Entity name: 7ff6db7051f0>) (5 . "1E8") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 19.2702 -4.33456 -4.33456) (11 20.351 -13.4291 0.0) (210 0.0 0.0 1.0) ) Quote
Stefan BMR Posted June 27, 2016 Posted June 27, 2016 Then you do the same with the end point. (setq el (subst new_end_point end_point el)) ( (-1 . <Entity name: 7ff6db706600>) (0 . "LINE") (330 . <Entity name: 7ff6db7051f0>) (5 . "1E8") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 19.2702 -4.33456 -4.33456) (11 20.351 -13.4291 -13.4291) (210 0.0 0.0 1.0) ) 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.