Results 1 to 10 of 10

Thread: Code help to run transparent

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Question Code help to run transparent

    Hello everyone,

    I am hoping that I can run this code as a transparent command like if you type 'p in the command line and you are in a middle of another command, the pan command will work.

    What I need is for the below code to be able to be run when I'm in the middle of another command.

    Code:
    (DEFUN C:os1()
    (SETVAR "CMDECHO" 0)
    (COMMAND "OSMODE" "1")
    (SETVAR "CMDECHO" 1)
    (princ)
    )
    Thanks for the help.

    Kyle C.

  2. #2
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    If you want something to be transparent you can't use 'command', IIRC. So just change your command call to a setvar call, and it should work when you type 'os1.

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    Tim,

    I am sorry I don't understand what you mean.

    I changed the code to this.

    Code:
    (DEFUN C:'os1()
    (SETVAR "CMDECHO" 0)
    (SETVAR CALL "OSMODE" "1")
    (SETVAR "CMDECHO" 1)
    (princ)
    )
    Got this

    'os1
    error: AutoCAD
    variable setting rejected: "OSMODE" "1"

    Then changed it to this.

    Code:
    (DEFUN C:'os1()
    (SETVAR "CMDECHO" 0)
    (SETVAR "OSMODE" "1")
    (SETVAR "CMDECHO" 1)
    (princ)
    )
    and got this.

    'os1
    error: AutoCAD
    variable setting rejected: "OSMODE" "1"

    Could you show me what needs to be changed in the code.

    Thanks,

    Kyle C.

    Quote Originally Posted by T.Willey View Post
    ...So just change your command call to a setvar call, and it should work when you type 'os1.
    Last edited by cadd4la; 2008-01-10 at 05:16 PM.

  4. #4
    100 Club
    Join Date
    2015-11
    Location
    Fairbanks, AK
    Posts
    136
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    Quote Originally Posted by cadd4la View Post

    ...Then changed it to this.

    Code:
    (DEFUN C:os1()
    (SETVAR "CMDECHO" 0)
    (SETVAR "OSMODE" "1")
    (SETVAR "CMDECHO" 1)
    (princ)
    )
    and got this.

    'os1
    error: AutoCAD
    variable setting rejected: "OSMODE" "1"

    Could you show me what needs to be changed in the code.

    Thanks,

    Kyle C.
    Kyle,

    Try this:
    Code:
    (DEFUN C:os1()
    (SETVAR "CMDECHO" 0)
    (SETVAR "OSMODE" 1)
    (SETVAR "CMDECHO" 1)
    (princ)
    )
    The extra "" in OSMODE can cause some trip ups.

    Hope this helps.

    Bill

  5. #5
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    Bill,

    Thanks for the input but that didn't fix the problem.

    Kyle

    Quote Originally Posted by blybrook View Post
    Kyle,

    Try this:
    Code:
    (DEFUN C:os1()
    (SETVAR "CMDECHO" 0)
    (SETVAR "OSMODE" 1)
    (SETVAR "CMDECHO" 1)
    (princ)
    )
    The extra "" in OSMODE can cause some trip ups.

    Hope this helps.

    Bill

  6. #6
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    All you will need is

    Code:
    (defun c:os1 ()
    (setvar 'OsMode 1)
    (princ)
    )
    Then when in command, you would call it like 'os1, the ' makes it a transparent call.

    Command: l LINE Specify first point:
    Specify next point or [Undo]:
    Specify next point or [Undo]:
    Specify next point or [Close/Undo]:
    Specify next point or [Close/Undo]: 'os1

    Specify next point or [Close/Undo]:
    Specify next point or [Close/Undo]:
    Specify next point or [Close/Undo]:

  7. #7
    100 Club
    Join Date
    2015-11
    Location
    Fairbanks, AK
    Posts
    136
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    Kyle,

    I tested it here and didn't pop up any errors. I have not been able to test it with other routines running, but will try after morning meetings.

    Bill

  8. #8
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Thumbs up Re: Code help to run transparent

    Tim,

    Thanks very much for the help.

    Kyle C.

  9. #9
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    You're welcome Kyle. Note that you can not use this while a lisp routine is running. You can't start a lisp in the middle of another lisp, not like this at least.

  10. #10
    100 Club
    Join Date
    2005-09
    Posts
    111
    Login to Give a bone
    0

    Default Re: Code help to run transparent

    Quote Originally Posted by cadd4la View Post
    Hello everyone,

    I am hoping that I can run this code as a transparent command like if you type 'p in the command line and you are in a middle of another command, the pan command will work.

    What I need is for the below code to be able to be run when I'm in the middle of another command.

    Code:
    (DEFUN C:os1()
    (SETVAR "CMDECHO" 0)
    (COMMAND "OSMODE" "1")
    (SETVAR "CMDECHO" 1)
    (princ)
    )
    Thanks for the help.

    Kyle C.
    Try
    Code:
    (vl-load-com)
    (defun C:os1() (vla-SendCommand (vla-get-ActiveDocument 
    (vlax-get-acad-object)) "'OsMode 1 ") (princ))
    Regards HofCAD CSI

Similar Threads

  1. Allow Other Code Compilers for ARX Code
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-02-10, 08:06 AM
  2. Insert vbscript code has not code
    By buzz in forum AMEP General
    Replies: 3
    Last Post: 2008-02-09, 03:08 AM
  3. transparent filled regions aren't really transparent
    By Justin Marchiel in forum Revit Architecture - General
    Replies: 8
    Last Post: 2006-11-30, 06:05 PM
  4. Filled region with transparent background not transparent
    By jwilhelm in forum Revit Architecture - General
    Replies: 1
    Last Post: 2005-09-12, 09:24 PM

Posting Permissions

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