Autoliso doesn't work since Autocad 2019, HELP PLEASE!

Autoliso doesn't work since Autocad 2019, HELP PLEASE!

bim8QKRA
Explorer Explorer
900 Views
4 Replies
Message 1 of 5

Autoliso doesn't work since Autocad 2019, HELP PLEASE!

bim8QKRA
Explorer
Explorer

Dear all,

I have the following autolisp which is running perfect for Autocad2018, but it doesn't work for Autocad2019.

What is the issue?

Thanks so much

 

 

(defun C:changehatchtoback ( / acblk acdoc acsel name obj processed )
(vl-load-com) (princ)

(setq acdoc (vla-get-activedocument (vlax-get-acad-object))
acblk (vla-get-blocks acdoc)
)
(if (ssget "_X" '((0 . "INSERT")))
(progn
(vlax-for block (setq acsel (vla-get-activeselectionset acdoc))
(if (not (member (setq name (vla-get-name block)) processed))
(
(lambda ( / lst )
(vlax-for obj (vla-item acblk name)
(if (AND (wcmatch (vla-get-layer obj) "*PATT*") (eq "AcDbHatch" (vla-get-objectname obj)))
(progn
(setq lst (cons obj lst))
)
)
)
(if lst
(vla-movetobottom (LM:SortentsTable (vla-item acblk name))
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray vlax-vbobject (cons 0 (1- (length lst)))) lst
)
)
)
)
(setq processed (cons name processed))
)
)
)
)

(vla-regen acdoc acallviewports)
)
)
(princ)
)

(defun LM:SortentsTable ( space / dict result )
(vl-load-com)
(cond
(
(not
(vl-catch-all-error-p
(setq result
(vl-catch-all-apply 'vla-item
(list (setq dict (vla-GetExtensionDictionary space)) "ACAD_SORTENTS")
)
)
)
)
result
)
( (vla-AddObject dict "ACAD_SORTENTS" "AcDbSortentsTable") )
)
)

0 Likes
901 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant

Edit: It looks fine. Do you get any error?

 

0 Likes
Message 3 of 5

mid-awe
Collaborator
Collaborator

I'm not sure if this can help for your version. I am using AC2020 and your code does not work for me either, but there is a built in HATCHTOBACK command and it works great. Maybe, unload your command and try to enter HATCHTOBACK @ the command line.

 

It could be that simple.

Hope this helps

0 Likes
Message 4 of 5

jreidCDS28
Participant
Participant

Never knew HATCHTOBACK. Works great.

 

I use a Toolbar I added that uses DRAWBACK & SSX combined that I might change to HTB.

 

^C^Cdr;(ssx);e;hatch;;;b;

 

DRAWORDER;

(SSX);

ENTITY;

HATCH;

2 RETURNS;

BACK;

 

 

 

 

0 Likes
Message 5 of 5

mid-awe
Collaborator
Collaborator

I'm glad that worked for you.

 

If you don't mind, I would appreciate it if you mark this as solved. Thank you.

0 Likes