ASD interrups script opening drawings, looking for alternatif

ASD interrups script opening drawings, looking for alternatif

Anonymous
Not applicable
1,130 Views
8 Replies
Message 1 of 9

ASD interrups script opening drawings, looking for alternatif

Anonymous
Not applicable

Hi i m working at a lisp to updates blocks from a script. the script is made by a lisp so we can go both directions.

It works fine in autocad, need some safetytriggers in but i will take care of it. 

 

The problem is we have a extension "Architectual structural detailing" that interruping the script. I started this also in ASD forum but don't think i will get a solution there, SO plan B is= Load the script only in Autocad 2015 en not in Architectual strcutural detailing, is this possible?

 

Link to ASD forum

http://forums.autodesk.com/t5/autocad-structural-detailing/script-open-command-getting-interupted-by...

 

Edit: first problem solved with working with trusted locations.

 

Second problem, if you work with script you better set your filedia on 0 

But when i hit close in ASD the close warning still popups see attachment.

 

any way to override this?

 

 

 

(defun ScriptBlock (/ DWGprefix Externfolder script)

  (setq DWGprefix (getvar "dwgprefix"))
  (setq Externfolder (strcat DWGprefix "\#Library-Do Not Edit#"))
  (setq script (strcat Externfolder "\\BinOpenDWGforTitleblock.SCR"))
  (if
    (and (setq trusted (getvar 'trustedpaths))
	 (not (vl-string-search Externfolder trusted))
	 )
    (setvar 'trustedpaths
	    (strcat (vl-string-right-trim ";" trusted) ";" Externfolder)
	    )
    )
  
  (command-s "script" script )

  );defun

 

 

(defun PUTEXCELPLANLIJST ( / dossval DWGprefix Externfolder script Drawings Drawing Files 
			  sf dossfile TextDoss ThisDwg Countblock CoFile Activefile AcFile
			  Lokaalfolder)

  (setq DWGprefix (getvar "dwgprefix"))
  (setq Externfolder (strcat DWGprefix "\#Library-Do Not Edit#"))
  (setq Countblock (strcat Externfolder "\\BinCountBlock.txt"))
  (setq ThisDwg (strcat DWGprefix (getvar "dwgname")))

  (setq dossval (get_tile "Projectnumber"))
    
  (setq Countblock (strcat Externfolder "\\BinCountBlock.txt"))
  (setq CoFile (open Countblock  "W"))
  (close CoFile)

  (setq Drawings (GetValList1))
  (setq script (strcat Externfolder "\\BinOpenDWGforTitleblock.SCR"))
  (foreach x Drawings
    (setq Drawing (strcat DWGprefix x ".dwg"))
    (if (not(= Drawing ThisDwg))
      (setq Files (cons Drawing Files))
      )
    )

  (if (> (length Files) 0)
	(progn
	  (setq sf (open script "w"))
	  (write-line "Filedia" sf)
	  (write-line "0" sf)
	  (write-line "_.qsave" sf)
	  (write-line "close" sf)
	  (foreach dwg Files
	    (write-line "_.open" sf)
	    (write-line (strcat "\""dwg "\"") sf)
	    (write-line "(load \"Dossier\")" sf)
	    (write-line "(DISTRIBUTEEXCELPLANNLIJST)" sf)
	    (write-line "_.qsave" sf)
	    (write-line "close" sf)
	    )

	  (write-line "_.open" sf)
	  (write-line (strcat "\"" ThisDwg "\"") sf)
	  (write-line "Filedia" sf)
	  (write-line "1" sf)
	  (write-line "(DISTRIBUTEEXCELPLANNLIJST)" sf)
	  (write-line "(AlertEditedblocks)" sf)
	  (write-line "_.qsave" sf)
	  (write-line "_.regen" sf)
	  (close sf)
	  )
	)
  (princ)
  ); Defun

 

 

Thanks.

0 Likes
Accepted solutions (1)
1,131 Views
8 Replies
Replies (8)
Message 2 of 9

hmsilva
Mentor
Mentor

Hi Dieter,

 

Instead of using the command in your script, try (setvar 'FILEDIA 0)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 3 of 9

Anonymous
Not applicable

Henrique, 

 

no luck, it stills pop up with close button

 

Tried also with a primitief way but also no luck, i tried to launch a ASD command and see what it returns but both nil (autocad and ASD). see below

(defun c:test (/ )
  
  (if (command "rbctoi" )
 
    (princ "yes")
    (princ "No")
    )

  )

 

 

 

0 Likes
Message 4 of 9

hmsilva
Mentor
Mentor
Try saving the dwg before.

Henrique

EESignature

0 Likes
Message 5 of 9

Anonymous
Not applicable

Still the same, see attached 

 

if i run AECversion it's the same, ASD has his own RBCTversion command.

Are there any commands for getting info about the program in lisp?

 

it would be enough if i can define it if it's ASD or Acad.

 

Thanks.

0 Likes
Message 6 of 9

hmsilva
Mentor
Mentor

@Anonymous wrote:

Are there any commands for getting info about the program in lisp?

it would be enough if i can define it if it's ASD or Acad.


Sorry Subje,

 

I've never used ASD...

 

Henrique

EESignature

0 Likes
Message 7 of 9

hmsilva
Mentor
Mentor

Subje,

just a thought...

 

Instead of calling the 'close' command from a script, just create an external function to close, test for SysVar 'DBMOD' and if not zero enter 'Y', possibly calling the the close command from a lisp will bypass the the dialog box...
e.g.

(defun myclose nil
(command "_.close") 
(if (not (equal 0 (getvar 'DBMOD))) (command "_Y"))
)

 

and in the script file call the function with (myclose)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 8 of 9

Anonymous
Not applicable

I m not sure if that will work because they are both above 0. Maybe i can focus me on the workspace? In asd - acad we have different workspaces cause ASD has his own toolbars. So that will always be different. 

 

But that's for this evening, gonna check that + see if i find more autocad-referention.

 

thanks 

0 Likes
Message 9 of 9

Anonymous
Not applicable
Accepted solution

Hi,

 

I found a solution for this, without using workspaces:

 

This function will check if it's ASD or not, you can use it as a part of your lisp.

 

(defun ASDCHECK  (/ LOGFILENAME Count LengthCompare Version)
  (setq LOGFILENAME (getvar "logfilename"))
  (setq Count (vl-string-search "\\autodesk\\autocad" LOGFILENAME))
  (setq LengthCompare (strlen "\\autodesk\\autocad"))
  (setq Version (substr LOGFILENAME (+ (+ LengthCompare Count) 2 ) 10))
  (if (eq Version "structural")
    (setq Version "ASD")
    (setq Version "NOT ASD")
    )
  Version
  )

 

Outcome is string: "ASD or "NOT ASD"

 

thanks.

0 Likes