Convert mode doesn't work when making a block

Convert mode doesn't work when making a block

3wood
Advisor Advisor
593 Views
9 Replies
Message 1 of 10

Convert mode doesn't work when making a block

3wood
Advisor
Advisor

Hi all,

I tried to make a block with command -block in a lisp file, but it doesn't convert selected objects into the new block. It seems "Retain" and "Convert" mode doesn't work in -block command:

(command "-block" "test" "mode" "convert" "0,0" "last" "")

Thanks for the help.

0 Likes
Accepted solutions (1)
594 Views
9 Replies
Replies (9)
Message 2 of 10

paullimapa
Mentor
Mentor
Message 3 of 10

Moshe-A
Mentor
Mentor

@3wood  hi,

 

Yes you are right, to me it looks like a 'bug', an option they forgot to add when it is called from (command) function 😂

 

Moshe

 

Message 4 of 10

hmsilva
Mentor
Mentor

@3wood wrote:

Hi all,

I tried to make a block with command -block in a lisp file, but it doesn't convert selected objects into the new block. It seems "Retain" and "Convert" mode doesn't work in -block command:

(command "-block" "test" "mode" "convert" "0,0" "last" "")

Thanks for the help.


Try

 

(command "block" "test123" "mode" "convert" "0,0" "last" "")
;or
(command "block" "test456" "mode" "retain" "0,0" "last" "")
;or
(command "block" "test789" "mode" "delete" "0,0" "last" "")

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 5 of 10

Moshe-A
Mentor
Mentor

@hmsilva ,

 

to make it clear, the block is created but it's not inserted (as it does when you do it manually) i am testing it on R2022

 

 

Message 6 of 10

hmsilva
Mentor
Mentor
Accepted solution

@Moshe-A wrote:

@hmsilva ,

 

to make it clear, the block is created but it's not inserted (as it does when you do it manually) i am testing it on R2022

 


@Moshe-A i did test in R2021, in R2022 didn't work as expected.

 

In R2022 and "2023 this work as expected...

 

 

 

(defun c:demo ( / s1 s2 s3)
    (if	(setq s1 (ssget))
      (progn
	(initcommandversion)
	(command "-block" "test123" "mode" "convert" "0,0" s1 ""))
    )
    (if	(setq s2 (ssget))
      (progn
	(initcommandversion)
	(command "-block" "test456" "mode" "retain" "0,0" s2 ""))
    )
    (if	(setq s3 (ssget))
      (progn
	(initcommandversion)
	(command "-block" "test789" "mode" "delete" "0,0" s3 ""))
    )
    (princ)
)

 

 

 

it's weird...

 

Edit: (initcommandversion 2) works in R 21, 22 and 23

Hope this helps,
Henrique

EESignature

Message 7 of 10

Moshe-A
Mentor
Mentor

@hmsilva  OK

 

Never cross my mind BLOCK is governed by (initcommandversion)  🤔

Message 8 of 10

3wood
Advisor
Advisor

(initcommandversion) works!

Thank you very much.

0 Likes
Message 9 of 10

paullimapa
Mentor
Mentor

So just need to do a test for the acad version.

If older than 2022, then use custom lisp, else use (initcommandversion)

(if(< (atoi(getvar"acadver"))24)
 (progn
 ...use custom lisp
 ) 
 (progn
   (initcommandversion)
 ...
 )
) ; if

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 10 of 10

hmsilva
Mentor
Mentor

@3wood wrote:

(initcommandversion) works!

Thank you very much.


You're welcome, @3wood 
Glad I could help

Henrique

EESignature