CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 05-08-2012, 04:42 AM
device0712 device0712 is offline
Registered User
 
Join Date: Nov 2009
Posts: 43
Question Error in lisp: the stream is already close??

Hi to all.
I' ve thi code LISP but second load (using defun insertdev) put this error :
Errore LISP:
The stream #<input stream "c:/eurocad/virtualcomponent/tmp/FileGeometry2loadModeling.lsp"> is already closed.

Code:
Code:
(in-package :ttscad)
(use-package :oli)

(sd-defdialog 'GetInsertPointDlg
    :dialog-title "Selezione inserimento"
    :prompt-text "Selezione inserimento"
    :variables
        '(
                  ; indicato che seleziono solo punto
          (select_3d_point
                  :value-type :point-3d
              :title "Seleziona il punto"
                  :prompt-text "Seleziona il punto"
                  ;:next-variable 'select_3d_point
                  :after-input (3d_point_selected)  
          );;select_3d_point
        )
    :local-functions
    '( 
        (3d_point_selected()
            (setf localwerte (oli::sd-vec-xform select_3d_point :source-space :global :dest-space :global))
            (defparameter *posX* (oli::gpnt3d_x localwerte) 0)
            (defparameter *posY* (oli::gpnt3d_y localwerte) 0)
            (defparameter *posZ* (oli::gpnt3d_z localwerte) 0)
            
            (defparameter *dir1X* 1 1)
            (defparameter *dir1Y* 0 0)
            (defparameter *dir1Z* 0 0)
            (defparameter *dir2X* 0 0)
            (defparameter *dir2Y* 1 1)
            (defparameter *dir2Z* 0 0)
          );;3d_point_selected
    )
    :cancel-action
    '(cancelcall)
    :ok-action  
    '(progn
       (defparameter *Owner* "/")
       (okcall)
     )
    :toolbox-button nil
)

(defun insertdev(szfile2load)
                (oli::sd-call-dialog GetInsertPointDlg)  'get poin
                (load szfile2load)   'load file lsp
                ;(post-load-reposition)
)

(defun test()
  (insertdev "c:/eurocad/virtualcomponent/tmp/FileGeometry2loadModeling.lsp")
  (insertdev "c:/eurocad/virtualcomponent/tmp/FileGeometry2loadModeling_1.lsp")
)
Someone can help me??
Thanks!
Device
Reply With Quote
  #2  
Old 06-04-2012, 05:04 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Error in lisp: the stream is already close??

Can you post the code for FileGeometry2loadModeling.lsp and FileGeometry2loadModeling_1.lsp?
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #3  
Old 06-04-2012, 05:20 AM
device0712 device0712 is offline
Registered User
 
Join Date: Nov 2009
Posts: 43
Re: Error in lisp: the stream is already close??

Hi.
I attach file .lsp, FileGeometry2loadModeling.lsp; FileGeometry2loadModeling_1.lsp is the same with different name.
Thanks
Attached Files
File Type: lsp FileGeometry2loadModeling.lsp (17.4 KB, 327 views)
File Type: lsp FileGeometry2loadModeling_1.lsp (17.4 KB, 313 views)
Reply With Quote
  #4  
Old 06-04-2012, 06:05 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Error in lisp: the stream is already close??

What happens if you load empty files instead of FileGeometry2loadModeling*.lsp?
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #5  
Old 06-05-2012, 12:00 AM
device0712 device0712 is offline
Registered User
 
Join Date: Nov 2009
Posts: 43
Re: Error in lisp: the stream is already close??

Same message, the files are empty!!!
I attach file .lsp with test code.
Thanks
Device
Attached Files
File Type: lsp test.lsp (2.1 KB, 327 views)
Reply With Quote
  #6  
Old 06-05-2012, 12:40 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Error in lisp: the stream is already close??

Question for clarification: In the latest test.lsp file, we find:

Code:
(defun test()
                    (insertdev "C:\\eurocad\\VirtualComponent\\tmp\\FileGeometry2loadModeling.lsp" )
                    (insertdev "C:\\eurocad\\VirtualComponent\\tmp\\FileGeometry2loadModeling_1.lsp" )
)
So even if the referenced files are empty, you still get the error if you run test.lsp. Correct? If so, I assume that in order to see the error, you have to load test.lsp, then execute (test). Correct again?

What happens if you comment out "(oli::sd-call-dialog GetInsertPointDlg)"?
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #7  
Old 06-05-2012, 03:49 AM
device0712 device0712 is offline
Registered User
 
Join Date: Nov 2009
Posts: 43
Re: Error in lisp: the stream is already close??

<So even if the referenced files are empty, you still get the error if you run test.lsp. Correct?>

Yes, correct!

<If so, I assume that in order to see the error, you have to load test.lsp, then execute (test). Correct again?>

I execute (ttscadenas1::ritest).....so correct!!

<What happens if you comment out "(oli::sd-call-dialog GetInsertPointDlg)"?>

No errors appears!!
Why GetInsertPointDlg do this error?
Some end of statement is missing?
Thanks!
Devi
Reply With Quote
  #8  
Old 06-05-2012, 06:22 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Error in lisp: the stream is already close??

What happens if you quote the GetInsertPointDlg symbol, for example like this:

(oli:sd-call-dialog 'GetInsertPointDlg)

OR

(oli:sd-call-dialog "GetInsertPointDlg")
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #9  
Old 06-05-2012, 06:43 AM
device0712 device0712 is offline
Registered User
 
Join Date: Nov 2009
Posts: 43
Re: Error in lisp: the stream is already close??

Thanks clausb but in this mode (oli::sd-call-dialog "GetInsertPointDlg") happens this:
load ths .lsp file and view dialog.....not sequency!!!

The sequence must be:
--> GetInsertPointDlg (request first point) mutual
--> load first .lsp
--> GetInsertPointDlg (request second point) mutual
--> load second .lsp

Thanks!
Devi
Reply With Quote
  #10  
Old 06-05-2012, 07:05 AM
clausb's Avatar
clausb clausb is offline
Registered User
 
Join Date: Nov 2002
Posts: 1,168
Re: Error in lisp: the stream is already close??

My proposal would be to get the two points *inside* GetInsertPointDlg, i.e. prompt the user for two points inside the same dialog, instead of calling the dialog twice.

Calling the dialog as (do-whatever GetInsertPointDlg) does not do what you probably thought it does. The reason is that dialog symbols are evaluated in a very special fashion. My blog series "And... Action!" has some background on this:

http://www.clausbrod.de/Blog/DefinePrivatePublic20090831AndAction

http://www.clausbrod.de/Blog/DefinePrivatePublic20090908AndActionPart2

http://www.clausbrod.de/Blog/DefinePrivatePublic20090919AndActionPart3
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/
Reply With Quote
  #11  
Old 06-06-2012, 12:45 AM
device0712 device0712 is offline
Registered User
 
Join Date: Nov 2009
Posts: 43
Re: Error in lisp: the stream is already close??

I think I understand .... I'll try. thanks Clausb!!!
Device
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:42 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.