• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Visual LISP, AutoLISP and General Customization

    Reply
    Distinguished Contributor
    Thomas.l
    Posts: 109
    Registered: ‎04-16-2011
    Accepted Solution

    Problems whit inserting block whit insert command

    162 Views, 5 Replies
    03-27-2012 01:59 PM

    Hi

     

    I am working on a lisp file that lets you select a block and automaticaly change the layer and color in block editor. Afther this it exits block editor, deletes the original block and places the new one.

     

    It works fine accept for the last part.

    When i incert my new name whit the insert command it automaticaly changes the name whit autofil so it wil still pot my originial block (the new block name is only two characters shorter than the old one).

     

    Is there eny way to work around this problem?

     

    Thanks in advance!

     

    Thomas

     

    P.S.: my apology's for the fact that my block is written in dutch

    Please use plain text.
    Contributor
    ranjith0326
    Posts: 24
    Registered: ‎04-16-2011

    Re: Problems whit inserting block whit insert command

    03-27-2012 09:47 PM in reply to: Thomas.l

     

    Hi Thomas,

     

    'Y' scale must be more than Zero, Please find the update in Below line.

     

    (command "insert" bln (cdr (assoc 10 (entget obl))) "1" "1" "")

    Regards,

    R.Ranjith
    Please use plain text.
    Distinguished Contributor
    Thomas.l
    Posts: 109
    Registered: ‎04-16-2011

    Re: Problems whit inserting block whit insert command

    03-28-2012 12:34 AM in reply to: ranjith0326

    Hi Ranjith

     

    Thank you for this responce it solved my problem.

     

    But how do you know which parameters you have to add? (like "1")

    I do it simply by trial and error.

     

    Regards

     

    Thomas

     

    P.S.: i had to make a litle adjustment, because i deleted the block befor i used it i had to get the insertion point sooner:

     

     

    (setq ip (cdr (assoc 10 (entget obl))))
      ;bepalen invoeg punt voor block, dit moet hier gebeuren omdat de block zelf straks verwijderd is en er dan geen waardes meer van opgevraagd kunnen worden
    
      (command
        "erase"
        obl ;original block
        ""
        )
      ;verwijder originele blcok
    
      (command
        "insert"
        bln
        ip
        "1"
        "1"
        ""
        )

     

     

    Please use plain text.
    Contributor
    ranjith0326
    Posts: 24
    Registered: ‎04-16-2011

    Re: Problems whit inserting block whit insert command

    03-28-2012 12:45 AM in reply to: Thomas.l

    Hi Thomas,

     

    That parameter is scale value of 'Y' Direction.... (you can change if you want to scaling your block).

     

    Enter manualy "-insert" in command line, you can see the step by step Input...

     

    (command
        "insert";Command
        bln;Block Name
        ip;Insert Point
        "1";Scale Value in X-Direction
        "1"        ;Scale Value in Y-Direction
        ""          ;Rotation Angle ("" for 0 degree")
        )

     

    Regards,

    R.Ranjith
    Please use plain text.
    Distinguished Contributor
    Thomas.l
    Posts: 109
    Registered: ‎04-16-2011

    Re: Problems whit inserting block whit insert command

    03-28-2012 12:51 AM in reply to: ranjith0326

    Hi Ranjith

     

    one more litle question:

    Can this be done for every command?

     

    Because i just tested it for saves and it doesn't work.

     

    Regards

     

    Thomas

    Please use plain text.
    Contributor
    ranjith0326
    Posts: 24
    Registered: ‎04-16-2011

    Re: Problems whit inserting block whit insert command

    03-28-2012 01:57 AM in reply to: Thomas.l

    Hi Thomas,

     

    If you want to see the step by step procedure for Saveas command,

     

    change filedia variable as "0", then try command saveas.....

     

     

    Also refer below link for more clear..

     

    http://www.afralisp.net/archive/methods/lista/saveas_method.htm

     

     

    Regards,

    R.Ranjith
    Please use plain text.