Author Topic: Change Contour Label Size using Visual Lisp  (Read 2355 times)

0 Members and 1 Guest are viewing this topic.

francishc

  • Mosquito
  • Posts: 1
Change Contour Label Size using Visual Lisp
« on: June 24, 2012, 02:57:24 AM »
I got some excellent help from Jeff M. with a problem that required modifying Point Label Styles.  I'm hoping I can get some more help related to that problem.  I have been using a lisp routine I wrote to label contours with individual text labels.  I thought it was about time I started using the contour labelling features of C3D but to do so I need to be able to adjust the style using lisp.  The reason for this was just recently discussed here: http://forums.autodesk.com/t5/AutoCAD-Civil-3D/Raster-Plot-Device-causes-C3D-Labels-to-rescale-improperly/m-p/3512850

I have been able to drill down to 'SurfaceStyles, 'SurfaceLabelStyles, 'ContourLabelStyles, and 'LabelProperties but I cannot find the property that...  Well thanks again Jeff M.  I took one last look at the code for point styles and it helped me identify the property necessary to make it work for contour labels.

Here is the core code modified to change Contour Label sizes:
Code: [Select]
(DEFUN changecontourlabelsize (changemode /)
  (IF c3difodoc
    NIL
    (LOAD "c3difodoc" "\nFile C3DIFODOC.LSP not loaded! ")
  ) ;_ end of IF
  (IF c3difodoc
    (PROGN
      (c3difodoc)
      (SETQ SrfLblStyles (VLAX-GET c3ddoc 'surfacelabelstyles)
            ContourLblStyles (VLAX-GET SrfLblStyles 'ContourLabelStyles)
      )
      (VLAX-FOR lblstyl ContourLblStyles
          (VLAX-FOR txt (VLAX-GET lblstyl 'TextComponents)
            (SETQ this_value (VLAX-GET (VLAX-GET txt 'height) 'Value))
            (VLAX-PUT (VLAX-GET txt 'height)
                      'value            ;(if (eq changemode "raster") 0.11 (/ 0.11 12.0)))
                      (COND
                        ((EQ changemode "raster") lblsz)
                        ((EQ changemode "normal") (/ lblsz 12.0))
                        ((EQ changemode "upsize") (* this_value upfactor))
                        ((EQ changemode "downsize") (/ this_value downfactor))
                        (T lblsz)
                      ) ;_ end of cond
            ) ;_ end of VLAX-PUT
          ) ;_ end of vlax-for
      ) ;_ end of VLAX-FOR
    ) ;_ end of PROGN
    (ALERT
      "Could not load C3DIFODOC.LSP!\nIt is required to initialize VisualLisp variables\nfor the Civil 3D interface Object,\nand the Civil 3D Active Document!"
    ) ;_ end of Alert
  ) ;_ end of IF
  (PRINC)
)

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Re: Change Contour Label Size using Visual Lisp
« Reply #1 on: June 24, 2012, 09:07:59 AM »
Glad I could help! :-)