Tomislav 发表于 2022-7-5 22:18:35

HELP with wlax-invoke-method

Hello, i need help with following line
 

(setq intersection(vlax-invoke-method vla_obj_first.IntersectWith(vla_obj_second, acExtendOtherEntity)))
 
i keep getting 'no function definition: VLA_OBJ_SECOND'...
of course i have converted two selected lines in vla objects; vla_obj_first and second, before calling that line...
thanx

hmsilva 发表于 2022-7-5 22:37:34

Try

(setq intersection (vlax-invoke-method vla_obj_first 'IntersectWith vla_obj_second acExtendOtherEntity))
 
Henrique

Tomislav 发表于 2022-7-5 22:45:31

that seems to work, but i added this
 

(setq intersection (vlax-safearray->list                  (vlax-invoke-method vla_obj_first 'IntersectWith vla_obj_second acExtendOtherEntity))) (princintersection)
 
to list that point, but i get 'bad argument type: safearrayp #'
how to list it?

hmsilva 发表于 2022-7-5 22:49:07

(princ (vlax-safearray->list (vlax-variant-value intersection)))
 
 
EDIT:
Tomislav,
using,

(setq intersection (vlax-invoke vla_obj_first 'IntersectWith vla_obj_second acExtendOtherEntity))
will return a normal point list or nil if no intersection found...
 
Henrique

Tomislav 发表于 2022-7-5 23:02:42

I FOUND IT
 

(setq intersection (vlax-safearray->list(vlax-variant-value                  (vlax-invoke-method vla_obj_first 'IntersectWith vla_obj_second acExtendOtherEntity)))) (princintersection)
 
THNX for help Henrique

Tomislav 发表于 2022-7-5 23:17:24

posted in same time as you so haven't saw your answer and it's great...i didn't know you can shorten it like that...many thanks

hmsilva 发表于 2022-7-5 23:24:56

You're welcome, Tomislav
Glad you got a solution.
 
 
Henrique
页: [1]
查看完整版本: HELP with wlax-invoke-method