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

Link file to x,y co-ordinate

7 REPLIES 7
Reply
Message 1 of 8
scousepete
235 Views, 7 Replies

Link file to x,y co-ordinate

I am looking for a program which would allow me to do the following:-
1. I have numerous blocks set in different 1000m x 1000m grid areas.
2. I need to select near to any of them and have a Lisp routine that will recognise the grid area and link to a scanned file using the x,y position I have selected.
Many thanks in advance if anyone can point me in the right direction. There are so many files I prefer not to use the 'Insert hyperlink' command!
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: scousepete

Can you upload the small part of this drawing
for the better understanding of your task?
Something similar I've did sometime ago but
for acad table with blocks

~'J'~
Message 3 of 8
scousepete
in reply to: scousepete

Thanks Fatty?!
I have uploaded a slimmed down version of the file - the original has thousands of blocks.
I am looking to be able to just click with the mouse on any block and have a lisp function that will recognise the x,y co-ordinate of the block and link it to a file.
I just didn't want to have to attach a hyperlink as there are thousands to do.
Any help pointing me in the right direction would be gratefully appreciated.
ScousePete
Message 4 of 8
Anonymous
in reply to: scousepete

What the format of the data must be in this text file?
e.g.
BlockName, X-coordinate, Y-coodinate separated
by comma, or another one?

~'J'~
Message 5 of 8
Anonymous
in reply to: scousepete

Here is a quick framework of what you
need just for testing
Text file should created in the same folder
with name Manholes.txt

Comments?

~'J'~

;;copy this code and save as wtx.lsp

(defun C:wtx (/ accum bn elist en i ss tmpstr tot txtfile txtname xc xstr yc ystr)

(setq ss (ssget (list (cons 0 "INSERT")(cons 66 1))) i -1)
(repeat (sslength ss)
(setq en (ssname ss (setq i (1+ i))))
(setq elist (entget en)
xc (car (cdr (assoc 10 elist)))
yc (cadr (cdr (assoc 10 elist)))
bn (cdr (assoc 2 elist))
xstr (rtos xc 3 3); in arch. units, must be (rtos xc 2 3) in dec. units
ystr (rtos yc 3 3); in arch. units, must be (rtos yc 2 3) in dec. units
tmpstr (strcat bn "," xstr "," ystr)
accum (cons tmpstr accum)
)
)
(setq accum (vl-sort accum '<))
(setq txtname (strcat (getvar "dwgprefix") "\\Manholes.txt") i 0 tot 0); <-- change text name to your suit

(setq txtfile (open txtname "a")); open text file for appending


(write-line (strcat "Drawing: " (strcat (getvar "dwgprefix")(getvar "dwgname"))) txtfile)
(write-line "------------------------------------------" txtfile)
(foreach itm accum
(write-line itm txtfile)
)
(write-line "------------------------------------------" txtfile)
(close txtfile)
)
(princ "\n Start command line with WTX...")
(princ)
Message 6 of 8
scousepete
in reply to: scousepete

The blocks in the drawing each have a scanned jpg file. I wanted to be able to click on any of the blocks and when I select it it opens up the scanned file.
For example if I click on the block '3205' it will automatically open up a jpg scan of a specification sheet for that block.
Thanks ever so much for all your help.
ScousePete
Message 7 of 8
Anonymous
in reply to: scousepete

Sorry, there is not clearly enough for me
I don't see any jpeg that was embedded in blocks
in your test.dwg
Can you create a folder with one drawing and
one of this jpeg files that linked with block
Then upload it there as zip file
Just to the better understanding for me...

~'J'~
Message 8 of 8
scousepete
in reply to: scousepete

Sorry J,
I am not very good at explaining!
We have scanned several thousand A4 sheets to jpg format. Each block in the file 'test' has its own sheet which gives detailed information on that particular block. These are in a dedicated folder on our server. I want to be able to click on any block and have the linked file open up in windows picture viewer.
I have left just 4 blocks in the file 'test' just as an example as there are several thousand.
Hope that explains it better.
Thanks for your patience.
ScousePete

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

Post to forums  

Autodesk Design & Make Report

”Boost