Boards /
Runtime/AutoLISP /
Topic 1779
html
Started by juan ·
2012-03-23 10:56 UTC ·
13 replies · SMF topic #1779
juan
2012-03-23 10:56 UTC
translation google Español Ingles
Hello I am new to OpenDCL and I want to thank you for this program,
my question is if I can from a html page to a command to the drawing. this is a draw button html for example the following command
(command "_line" "0,0,0" 10,10,20 "" "" ")
A greeting and thanks
fred_tomke
2012-03-23 22:56 UTC
Hm, what did you want to tell us?
Fred
roy_043
2012-03-24 10:23 UTC
I think the OP wants to know if you can use a button on a HTML page to trigger a lisp action. If this is possible it would be a strange way to use ODCL.
DanW
2012-03-26 15:55 UTC
It's way beyond me, but a chap called Techjunkie80 has attempted this. See the thread below:
{2}
juan
2012-03-26 15:55 UTC
yes I want that, I would like to insert blocks from a html page, is it possible?
roy_043
2012-03-27 09:10 UTC
author=juan link=topic=1779.msg8739#msg8739 date=1332777345 wrote:
yes I want that, I would like to insert blocks from a html page, is it possible?
But in your original post you mention the line command?
juan
2012-03-27 11:06 UTC
yes, I wanted to give an example, the project I want to do is insert blocks in a database, execute it with pages. asp
DanW
2012-03-27 11:30 UTC
Yes, sounds very do-able in my opinion.
1. Press the relevant button on the HTML page.
2. The Html Control navigates to a dedicated page which triggers the control's NavigationComplete event.
3. The NavigationComplete event triggers your lisp code which determines the desired block name and then inserts the actual block itself into your drawing from an ftp server.
juan
2012-03-27 13:20 UTC
Thanks I will try and tell you
DanW
2012-03-27 13:34 UTC
Yes please. Step 3 will be the fun bit.
juan
2012-03-29 08:09 UTC
Sorry but I can not do it, try it with javascript
function Aplicar()
{
insertblock23();
}
function Aplicar()
{
insertblock23();
}
or
window.parent.location.href='insertblock23'
You can set an example?
DanW
2012-03-29 14:36 UTC
I was thinking of avoiding javascript and doing it through lisp. You would need to configure your website so when you click on the relevant "Insert Block" button on the web page it navigates to a particular webpage (with the same name as your block) and triggers the OnNavigationComplete event for the Html control.
You would need a naming convention for your blocks/web pages such as "Juan_Block1" etc. The below is untested and may not be how you want to do it, but hopefully it gives you an idea of the approach I was thinking of.
;;on navigation complete event for the html control
(defun c:HTMLTest_Form1_Html1_OnNavigationComplete URL / WebPageName BlockName)
;get the location of new page
(setq WebPageName (dcl_Html_GetLocationName HTMLTest_Form1_Html1))
;check the location name corresponds to a block name
(if (wcmatch (strcase WebPageName) "JUAN_*")
(progn;then
;get the block name and path
(setq BlockName (strcat "http://www.YourWebsite.com/Blocks/" WebPageName ".dwg"))
;now insert the block into the drawing
(INSERT_REMOTE_FILE BlockName)
;navigate back to the original web page
(dcl_Html_Navigate HTMLTest_Form1_Html1 "www.YourWebsite.com[url=http://][url=http://]")
);endprogn
);endif
);endfun
;;subroutine to download then insert a block from a ftp server
(defun INSERT_REMOTE_FILE (RemoteFile / TempInternetFile NewFile sym *acad* *doc* *util*)
(vl-load-com)
(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))
(setq *util* (vla-get-utility *doc*))
(vl-catch-all-apply
'vla-getremotefile
(list *util* RemoteFile 'TempInternetFile actrue)
)
(if TempInternetFile
(progn;then
;Rename the temporary internet file as dwg
(setq NewFile (strcat (vl-filename-directory TempInternetFile) "\\" (vl-filename-base RemoteFile) ".dwg"))
(vl-file-rename TempInternetFile NewFile)
);endprogn
);endif
(if (findfile NewFile)
(progn;then
;insert the file
(command "_.insert" NewFile "_scale" 1 pause "")
;then delete the old File if you wish
(vl-file-delete NewFile)
);endprogn
);endif
);endfun
bazzacad
2012-03-29 16:57 UTC
Great looking code Danner, I'll have to try it out myself.
I edited your code with the line #9 change & removed the last post to avoid confusion.
thx for the contribution. If this works it should go into "Show & Tell"
DanW
2012-03-30 08:26 UTC
Thanks Barry, very much appreciated.
There is probably a bug or three in there to be ironed out. I want to develop it and test it further when I get a chance and then possibly put it in "Show and Tell" in due course (assuming it actually works!).