See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: CleanscreenON error

  1. #1
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default CleanscreenON error

    Assuming that the current value of CLEANSCREENSTATE system variable is 0 (zero) and bname is a block name existing in the current drawing.
    Inside the code below, INSERT command is canceled if prior it has been used CleanscreenON command!

    Any explanation?

    Code:
    (defun INSBK (bname / kst)
    	(if (= (getvar "CLEANSCREENSTATE") 0) (setq kst (vl-cmdf "_.CLEANSCREENON")))
    	(vl-cmdf "_.-INSERT" bname PAUSE 1. 1. 0.)
    	(if KST (vl-cmdf "_.CLEANSCREENOFF"))
    )
    Thank you

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    Not sure, but you are not returning the system variables back to their original state once the command is finished. It may have to do with a timing issue for the cleanscreenon command.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    Thank you Opie for your answer.
    As you can see, my code is a simple one. I didn't change inside it any system variables values. Check my code by yourself, please.
    What exactly do you want to say with: "It may have to do with a timing issue for the cleanscreenon command."? A Delay or what?
    Because I suspect an internal (Auto)CAD platform error but in the meantime I hope I'm wrong, if someone could tell me where I'm wrong.

  4. #4
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    Per your code, you check the status of cleanscreenstate. Of it is set to 0, you then change it to 1 by using the cleanscreenon command.

    At the end, regardless of the status of cleanscreenstate, you execute the cleanscreenoff command.

    Now, regarding the insert command, are you certain the block being inserted is not set to scale uniformly? If it is set to scale uniformly, then the second 1. added to the prompt will be wrong. You will need to query the block definition to determine that value prior to using the insert command to place it.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  5. #5
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    Block definition, using (entget (TBLOBJNAME"BLOCK""DS____PROBA-MODEL")), looks like this:

    Code:
    ((-1 . <Entity name: -13c3b8>) (0 . "BLOCK") (330 . <Entity name: -13c3c0>) (5 
    . "19339") (100 . "AcDbEntity") (67 . 0) (8 . "DSTB____DSandTB") (370 . -2) 
    (100 . "AcDbBlockBegin") (70 . 2) (10 -52.337 16.3151 0.0) (-2 . <Entity name: 
    -13c3b0>) (2 . "DS____PROBA-Model") (1 . "DS____PROBA-Model"))
    If we talk about block scaling, we need to take in account the inserted block. With entget function it look like this:

    Code:
    ((-1 . <Entity name: -13acd8>) (0 . "INSERT") (330 . <Entity name: -13d120>) (5 
    . "1941D") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . 
    "DSTB____DSandTB") (100 . "AcDbBlockReference") (66 . 1) (2 . 
    "DS____PROBA-Model") (10 359.07 215.416 -587.287) (41 . 1.0) (42 . 1.0) (43 . 
    1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))
    Groups 41, 42 and 43 refers to the scale at which the block was inserted.

    In my code, we talk about BLOCK not about INSERT.

    Anyway, suppressing a 1. didn't solve the problem.
    Last edited by BlackBox; 2016-08-11 at 07:32 PM. Reason: Please use [CODE] Tags

  6. #6
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    It seems to me the cleanscreenon command is causing a problem for you. Removing that command allows the user to graphically view the block attached to the cursor. However, you can request the user to supply a point prior to the insert command in your code. Replacing this user specified point with the pause within the insert command line, the block is placed.

    Back to the block definition, if it is set to be uniformly scaled, the second 1. will place a rotation of 1. instead of the assumed 0. The 0. will then be placed on the command line for no additional purpose.

    To me, changing the user's screen appearance to place a block is a bit too far. I would certainly complain about that as the user of this routine. Inserting a block from a tool palette or from design center doesn't change the UI and I would see no benefit to doing so now.

    Anyway, good luck on your solution.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  7. #7
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    1

    Default Re: CleanscreenON error

    Silly question time....

    Why do you feel the need to enable clean screen, just to insert a block?
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  8. #8
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    Hello Opie.
    Thank you for you time and effort.
    Unfortunately the problem remains: it is or it is not the behavior or CLEANSCREEN command an AutoCAD internal error?

  9. #9
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    Hello BlackBox

    The story is a little longer.

    All starts from the program sequence below.
    Code:
    (prompt (strcat "\nClick on screen the Block " bname " insertion point, please"))
    (if (and (setq $kl (findfile "LKB.EXE"))(setq $ku (findfile "UKB.EXE")))(startapp $kl))
    (vl-cmdf "_.-INSERT" bname PAUSE 1. 1. 0.)
    (if (and $kl $ku)(startapp $ku))
    For my application, it is mandatory to give the user the ability to insert the block "bname" dynamically into the drawing (phantom of block "bname" hanged on mouse crosshair). I have not found another solution but using INSERT command and a PAUSE to let the user click on screen the block insertion point. On the other hand I don't want to give the user the possibility to press any key or to use any menu option because my application crash (I suspended a dialog so that the user select that damn point!).

    The solution that I found is based on information from the site https://autohotkey.com.
    In fact, LKB.EXE (Windows OS process) locks the keyboard and confines the mouse inside window working space and UKB.EXE kills the LKB.EXE process.

    For amuzament, in a ZIP attached file there are the sources of two programs. Program sources could be compiled by using AHK2EXE.EXE compiler from autohotkey site. EXE files obtained after compilation are relatively large (more than 300 kB).

    The solution doesn't satisfy me at least because:
    1. LKB.EXE interact with any antivirus program (LKB.EXE and UKB.EXE use keyboard/mouse interruptions). So, the user must be instructed to scan the exe files prior using my application and so on...
    2. Using those EXE file, my application is slowing down.

    So that, I tried to find another solution. A partial one might be CLEANSCREENON command. And...OOPS! I found the error which I described in my first post.

    That's all story...
    Attached Files Attached Files

  10. #10
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: CleanscreenON error

    Instead of restricting the user, handle the possible error that would cause your program to crash. CleanScreenOn appears to not work in your current solution. I don't believe there is any way to get it to work in your solution using AutoLISP.

    If you want to restrict the user that much, you may need to move to a more powerful language, as AutoLISP is not as powerful as others.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 2012-09-20, 09:14 AM
  2. Replies: 0
    Last Post: 2011-03-17, 06:54 PM
  3. Replies: 8
    Last Post: 2009-10-27, 12:03 PM
  4. Error when loading custom linetype - Error reading shape file
    By drafting.82475 in forum AutoCAD Customization
    Replies: 4
    Last Post: 2007-04-19, 07:36 AM
  5. Replies: 2
    Last Post: 2007-03-02, 08:57 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •