Tharwat Posted August 24, 2016 Posted August 24, 2016 Thanks man! I will try it tomorrow! And try to clean all the post as well.. You are welcome - waiting for your test. So do you think it is not a good idea dig inside dictionaries, right? Not really having a dictionary for each line that should increase the size of drawings in no time although that is not a good idea in my opinion. Off topic: what kind of drink you are talking in that personal photo in your profile on YouTube? is it Mate? Quote
MastroLube Posted August 24, 2016 Author Posted August 24, 2016 Off topic: what kind of drink you are talking in that personal photo in your profile on YouTube? is it Mate? ahahah 4 years ago I was in a relationghip with a girl in London, she was Italian anyway.. I use to go there and one day I got a Juice! It was very good! https://uk.westfield.com/london/stores/all-stores/boost-juice-bars/56005 this one! Topic: it does't do anything :S I copied a part of a project, just have a try! (it's just a copy and paste, no dictionary involved) test1.dwg Quote
Tharwat Posted August 24, 2016 Posted August 24, 2016 Your firstly two examples in this thread is completely different than this lastly attached drawing, so no luck with that design in this case. Quote
MastroLube Posted August 24, 2016 Author Posted August 24, 2016 yeah, but the goal was different XD try to correct the dictionary that addon uses.. as I said a drawing could be very complex.. I can give you more information: diameters are connected with colors. phi 8 -> 3 (not common) phi 10 -> 2 phi 12 -> 130 phi 14 -> 86 phi 16 -> 150 phi 18 -> 200 phi 20 -> 7 phi 22 -> 220 phi 24 -> 2 (not common) phi 26 -> 150 (not common) An idea could be create an identical quote that count how many bars of the same time it intersect ! Quote
Roy_043 Posted August 24, 2016 Posted August 24, 2016 @MastroLube: I hope that in your research you have stumbled on the fact that the app also uses Xdata... Why don't you get in touch with the developer regarding this issue? Quote
MastroLube Posted August 24, 2016 Author Posted August 24, 2016 @MastroLube:I hope that in your research you have stumbled on the fact that the app also uses Xdata... Why don't you get in touch with the developer regarding this issue? Well, I didn't consider xDATA!! I don't know much about that.. I only know there is a command "xdata" in the express tool.. maybe this is the key? cool About talking with the dev, we are using an old version of this software which is fine.. new versions have bugs in other place that our version doesn't have. Can you give me an advice about xdata? Quote
Roy_043 Posted August 25, 2016 Posted August 25, 2016 To find all Xdata for an entity: (entget (car (entsel)) '("*")) Generic Xdata functions: ; (KGA_Data_XdataGet (car (entsel)) "MYAPP") (defun KGA_Data_XdataGet (ename app) (cdadr (assoc -3 (entget ename (list app)))) ) ; (KGA_Data_XdataSet (car (entsel)) "MYAPP" '((1000 . "ghi") (1000 . "jkl") (1000 . "mno") (1010 1.0 3.0 5.0))) (defun KGA_Data_XdataSet (ename app dataLst) (regapp app) (entmod (append (entget ename) (list (list -3 (cons app dataLst))) ) ) ) Quote
MastroLube Posted August 29, 2016 Author Posted August 29, 2016 Thank you very much Mr. Roy_043!! I've dumped some entities on my drawing in order to find the relationship between that.. That is what I've discovered: (assoc -3 (entget (car (entsel)) '("*"))) 1. bars coming from a series have the same (1000 . "xx") (-3 ("SETEC_AUTOCA_BARRA_XDATA" (1000 . "71") (1000 . "133577") (1070 . 1)) ("SETEC_AUTOCA_GEN_BARRE_XDATA" (1000 . "71") (1000 . "71"))) 2. generator of the bar has the same (1000 . "xx") of the bars (-3 ("SETEC_AUTOCA_GEN_BARRE_XDATA" (1000 . "71") (1000 . "71"))) 3. unfortunately the quote (and all his components) has another number :/ (-3 ("SETEC_AUTOCA_RICHIAMO_XDATA" (1000 . "16") (1000 . "16"))) At this point I've 2 ideas: 1. associates quotes to bars manually (add an xdata to the quote -> the number ) unfortunately every time I move that quote, the xdata will regen and I lose my informations 2. find the relation between the number of the quote and the number of bar EDIT: I've got another idea.. find which line has in common his endpoint with the generation line extract the the xdata of it (which is the same of the text) modify the text with the right number of bars could it work? Quote
MastroLube Posted October 3, 2016 Author Posted October 3, 2016 I've got another Idea, maybe this is the best I've ever had! Create a custom quote, which looks exactly as the original. 1. I track a line 2. a lisp dumps the objects that intersect that line 3. In each point it insert the arrow (to looks as the original) 4. it counts all these intersection points 5. it gets the number of the bar from the xdata (I have to save somewhere what that number is.. phi 12, phi 20 and his length) 6. the lisp writes the correct value of everything! 7. I will add something that refresh these quotes, if something change.. (maybe a reactor) Looks possible? Quote
BIGAL Posted October 4, 2016 Posted October 4, 2016 1 track a line (ssget "f" ptlist) note ptlist can be pick two pts 2 not required if you do 1 as you have the list 3 intersect with dummy line ptlist 4 yep 5 retrieve xdata from object 6 yep 7 leave that to you Quote
MastroLube Posted October 4, 2016 Author Posted October 4, 2016 Thank for reply! I've done some work in the freetime.. (thanks to Mr Lee for the functions I've found in his site) (defun c:test ( / e i n s x ) (setq int_list nil) (setq ptlist (list (getpoint) (getpoint))) (vl-cmdf "_line" (car ptlist) (cadr ptlist) "") (setq pline (cdr (assoc -1 (entget (entlast))))) (if (setq s (ssget "_F" ptlist '((0 . "LINE")))) (progn (setq i 0 n (sslength s) ) (while (< i n) (setq e (ssname s i) x (cdr (assoc 0 (entget e))) i (1+ i) ) ;(print x) (setq int (car (LM:intersections (vlax-ename->vla-object pline) (vlax-ename->vla-object e) acextendnone))) (vl-cmdf "_-insert" "aca_freccia" int 0.1 0.1 (* 180 (/ (angle (car ptlist) (cadr ptlist))) pi)) (setq int_list (append int_list int)) ) ) ) (princ) ) (defun LM:intersections ( ob1 ob2 mod / lst rtn ) (setq lst (vlax-invoke ob1 'intersectwith ob2 mod)) (repeat (/ (length lst) 3) (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn) lst (cdddr lst) ) ) (reverse rtn) ) in the gif you can see the original behavior and then my lisp.. I don't know why the orientation of arrows is wrong.. ( don't know why but the gif doesn't start.. I've uploaded here too:https://giphy.com/gifs/3o7TKtXBWc4vnFGrPq) I'll continue tomorrow, if you have other advices I'll be happy to read them Quote
Lee Mac Posted October 4, 2016 Posted October 4, 2016 By using the Fence selection mode, the points of intersection are actually already available: (defun c:test ( / ang blk bln ocs pt1 pt2 scl sel ) (setq bln "aca_freccia" ;; Name/filepath of block to insert scl 0.1 ;; Block Scale ) (cond ( (not (setq blk (LM:importblock bln))) (princ (strcat "\nBlock \"" bln "\" could not be located.")) ) ( (not (and (setq pt1 (getpoint "\nSpecify 1st point: ")) (setq pt2 (getpoint "\nSpecify 2nd point: " pt1)) ) ) ) ( (not (setq sel (ssget "_F" (list pt1 pt2) '((0 . "LINE"))))) (princ "\nNo crossing lines found between points: ") ) ( (setq ocs (trans '(0 0 1) 1 0 t) ang (angle pt1 pt2) ) (foreach pnt (vl-remove-if-not 'listp (apply 'append (ssnamex sel))) (entmake (list '(000 . "INSERT") (cons 002 blk) (cons 050 ang) (cons 041 scl) (cons 042 scl) (cons 043 scl) (cons 010 (trans (cadr pnt) 1 ocs)) (cons 210 ocs) ) ) ) (entmake (list '(000 . "LINE") (cons 010 (trans pt1 1 0)) (cons 011 (trans pt2 1 0)) ) ) ) ) (princ) ) ;; Import Block Definition - Lee Mac ;; blk - [str] Block name, drawing filename, or full filepath ;; Returns: [str] Block name if successful, else nil (defun LM:importblock ( blk / bse cmd ext pth ) (setq pth (vl-string-translate "/" "\\" (vl-filename-directory blk)) ext (cond ((vl-filename-extension blk)) (".dwg")) bse (vl-filename-base blk) ) (if (not (or (= "" pth) (wcmatch pth "*\\"))) (setq pth (strcat pth "\\")) ) (cond ( (tblsearch "block" bse) bse) ( (setq blk (findfile (strcat pth bse ext))) (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0) (command "_.-insert" blk nil) (setvar 'cmdecho cmd) (if (tblsearch "block" bse) bse ) ) ) ) (princ) Quote
MastroLube Posted October 7, 2016 Author Posted October 7, 2016 Wow Mr.Lee, that code looks very professional compared to mine! I'll use it as a start point! The changes I'll try to do are: -ask for the type of bar to quote (just select one of them: there is an Xdata with the number) -create a polyline instead of a line and trim it at the last bar -rotate by 180degree the blocks This will be the first step thanks Quote
Lee Mac Posted October 7, 2016 Posted October 7, 2016 You're welcome - good luck with the remainder of your coding! 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.