Author Topic: Run command of an event in form palette  (Read 874 times)

hildevascorou

  • Member
  • *
  • Posts: 4
Run command of an event in form palette
« on: October 27, 2021, 04:48:14 PM »
Hello
I'm having problem with palette type form in which I have a combo box containing the names of the polygons
I want that when selecting it, the object in the drawing is zoomed in according to the attached codes.
I am grateful to anyone who can help me because all the attempts I made were unsuccessful to make the zoom command run

Combobox event example

Combobox list contains object names

(defun c:cmbPolygonoSet_OnSelChanged ( ItemIndexOrCount Value )
  (setq LstMinMax (CalMinMax Value 10.0))
  (vl-cmdf "zoom" "w" (nth 0 LstMinMax) (nth 1 LstMinMax))
)

;Routine to calculate the minimum and maximum point of an object
(defun CalMinMax ( NPol DxDy / ObjPol PMin PMax LstPMinPMax )
  (setq ObjPol (vlax-ename->vla-object NPol))
  (vla-getboundingbox ObjPol 'PMin 'PMax)
  (setq PMin (mapcar '- (vlax-safearray->list PMin) (list DxDy DxDy 0.0)))
  (setq PMax (mapcar '+ (vlax-safearray->list PMax) (list DxDy DxDy 0.0)))
  (setq LstPMinPMax (list PMin PMax))
   LstPMinPMax
)