Navigating C3D API - Assigning Values to Variables within Styles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been working on a routine to help adjust the text height (hopefully someday more fields as needed) of Civil 3D Note Label through direct edits of the Note Label Style. The goal of this routine is to grab a number of note labels, and for each label, get it's corresponding style and adjust the text height field of the style (basically a bulk edit).
I received some great help with the bulk of the code from this forum and tried to expand on it but still feel as if I'm missing how to reference various interfaces for these styles. Below, if I remove lines 14-18, the code functions as intended except dragged components retain their original text height. Looking around in the API I thought I would understand how to map to the draggedcomponentstyle and adjust the 'textheight' field (see images below) but I receive this error saying I have a bad argument type.
The program seems to recognize the interface object but I don't know if I have a problem with my text height argument (input, name, etc.) or something else. Any help with debugging my bad argument type would be appreciated. I apologize too as I'm still very new to the lisp routines.
(defun c:test (/ th ss i lbl style txtcomponents dcs)
(setq th (getreal "Enter Paperspace Height (inches): ") ) ;; ext Height 'th' for paper space
(if (setq ss (ssget "_:R" '((0 . "AECC_GENERAL_NOTE_LABEL"))))
(progn
(setq i 0)
(while (setq ent (ssname ss i))
(setq lbl (vlax-ename->vla-object ent))
(setq style (vlax-get lbl 'labelstyle)
txtcomponents (vlax-get style 'textcomponents)
)
(vlax-for comp txtcomponents
(vlax-put comp 'height (/ th 12)) ;; Plotted height based on user input
)
(setq style (vlax-get lbl 'labelstyle)
dcs (vlax-get style 'draggedcomponentstyle)
)
(vlax-for com dcs
(vlax-put com 'textheight (/ th 12)) ;; Plotted height based on user input
)
(setq i (1+ i))
)
)
)
(princ)
)
Img 1 - Label Style
Img 2 - Dragged Component Style