Jump to content

Find where are stored information about an entity


Recommended Posts

Posted
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?

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • MastroLube

    18

  • Tharwat

    11

  • Lee Mac

    2

  • Roy_043

    2

Top Posters In This Topic

Posted Images

Posted

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! :D

 

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

Posted

Your firstly two examples in this thread is completely different than this lastly attached drawing, so no luck with that design in this case.

Posted

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 !

Posted

@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?

Posted
@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 :shock:

 

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?

Posted

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)))
   )
 )
)

Posted

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?

  • 1 month later...
Posted

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?

Posted

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

Posted

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..

attachment.php?attachmentid=59408&cid=1&stc=1

( 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.jpg

Posted

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)

Posted

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

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...