Author Topic: Civil3D - General Label (Dialog Box) Command line?  (Read 12465 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Civil3D - General Label (Dialog Box) Command line?
« on: December 17, 2015, 11:37:45 AM »
I did not know if it was possible to make quick commands to access the general label note styles?
Civil3D 2020

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #1 on: December 17, 2015, 11:45:34 AM »
I don't believe so. However, you can create macros with the help of some lisp.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #2 on: December 17, 2015, 11:57:19 AM »
Could you share an example? IF the Feature: Note, and the Label Type: Note, Note Label Style: Standard2 (Custom) and Marker Style: <none>?
Civil3D 2020

mjfarrell

  • Seagull
  • Posts: 14444
  • Every Student their own Lesson
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #3 on: December 17, 2015, 12:17:32 PM »
^c^cADDNOTELABEL  should work

just have your feature settings set to use label style you are most often using
Be your Best


Michael Farrell
http://primeservicesglobal.com/

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #4 on: December 17, 2015, 12:58:10 PM »
Could you share an example?
Here is the code to set the current NoteLabelStyle. The Style MUST already exist, else it will puke.
Code - Auto/Visual Lisp: [Select]
  1. (defun setnotelblstyle (style2use / *ACAD* C3D C3DDOC NOTECMDSETS NOTELBLSETS NOTESTYLE SETS STYLESETS
  2.                                         *error*)
  3.   (defun *error* (msg / tmp)
  4.     (if msg (princ (strcat "\n....error.... " msg))
  5.       )
  6.     (setq tmp (mapcar '(lambda (x)
  7.                          (vl-catch-all-apply
  8.                            'vlax-release-object (list x))
  9.                            )
  10.                       (list  NOTECMDSETS NOTELBLSETS NOTESTYLE SETS STYLESETS c3ddoc c3d *acad*))
  11.       )
  12.     )
  13.    
  14.            (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  15.                              (if vlax-user-product-key
  16.                                (vlax-user-product-key)
  17.                                (vlax-product-key)
  18.                              )
  19.                      )
  20.                  C3D (vl-registry-read C3D "Release")
  21.                  C3D (substr C3D
  22.                              1
  23.                              (vl-string-search
  24.                                "."
  25.                                C3D
  26.                                (+ (vl-string-search "." C3D) 1)
  27.                              )
  28.                      )
  29.                  C3D (vla-getinterfaceobject
  30.                        *acad*
  31.                        (strcat "AeccXUiLand.AeccApplication." C3D)
  32.                      )
  33.            )
  34.            (setq C3Ddoc (vla-get-activedocument C3D))
  35.       )
  36.     (progn
  37.       (setq sets (vlax-get c3ddoc 'settings))
  38.       (setq notecmdsets (vlax-get sets 'generalcommandssettings))
  39.       (setq notelblsets
  40.              (vlax-get notecmdsets
  41.                        'AddNoteLabelSettings
  42.              )
  43.       )
  44.       (setq stylesets (vlax-get notelblsets 'stylesettings))
  45.       (setq notestyle (vlax-get stylesets 'notelabelstyle))
  46.       (vlax-put notestyle 'value style2use)
  47.       (*error* nil)
  48.     )
  49.   )
  50. )
  51.  
Make sure this lisp loads with each dwg (adding it to your acaddoc.lsp file would be one method). Then create new command(s) in the CUI with this for the macro:

^C^C(setnotelblstyle "Water Connection Note");ADDNOTELABEL

Use this for each button macro you want to use...replacing "Water Connection Note" with whatever note style you need.

You will see that I did not include the option for the marker. As far as I can find, this setting is not available in the COM API.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #5 on: December 17, 2015, 12:59:55 PM »
Jeff,
Your brains are amazing! Thanks Man.
Civil3D 2020

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #6 on: December 17, 2015, 03:23:03 PM »
Just to brainstorm on this alittle more. I can still swap these notes to the others if I can find the right variables?
(Line and Curve / Alignment / Surface / Pipe Network) lol.
Civil3D 2020

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #7 on: December 17, 2015, 04:12:35 PM »
Yes you can, I actually snagged most of that code from one I did long ago for Surface SpotElevationLabels. It could probably even be rewritten to be more generic so you'd pass in the type of labelstyle long with the style name. But that would take a bit more time than I have right now.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #8 on: December 17, 2015, 04:15:31 PM »
Don't get me wrong. There is a lot of Clicking with in Civil3D to get what you want sometimes. Being able to have type in exactly whatcha want.... Now that's awesome there.
Civil3D 2020

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #9 on: September 05, 2018, 01:32:22 PM »
MSTG007 contacted me about this today. Rather than send a private response, I will post what I can here in case anyone else wants to utilize the code. After some thought I decided that a generic function to handle all cases would not work too well. So here are a few different functions for General Lines/Curves and Surface SpotELevations:
Code - Auto/Visual Lisp: [Select]
  1. ;|lisp to help with line/arc labeling to avoid using the stock C3D
  2.   style selection form.
  3.   By: Jeff Mishler, Quux Software...Creators of the Sincpac-C3D add-on package
  4. |;
  5. ;;Example macro for a toolbar/toolpalette button
  6. ;;(quuxaddlabel "Distance Only" "Distance Only")
  7.  
  8. (defun quuxaddlabel (linestyle2use arcstyle2use)
  9.   (setsgmntlblstyle linestyle2use arcstyle2use)
  10.   (command "_ADDSEGMENTLABEL")
  11.   (princ)
  12.   )
  13.  
  14. ;; note that the label styles MUST exist or it will puke
  15. ;; suggest adding error handling to help with that
  16. ;; pass the line label style name and arc label style name
  17.  
  18. (defun setsgmntlblstyle (linestyle2use arcstyle2use / *ACAD* C3D C3DDOC sgmntCMDSETS sgmntLBLSETS sgmntSTYLE SETS STYLESETS
  19.                                         *error*)
  20.   (defun *error* (msg / tmp)
  21.     (if msg (princ (strcat "\n....error.... " msg))
  22.       )
  23.     (setq tmp (mapcar '(lambda (x)
  24.                          (vl-catch-all-apply
  25.                            'vlax-release-object (list x))
  26.                            )
  27.                       (list  sgmntCMDSETS sgmntLBLSETS sgmntSTYLE SETS STYLESETS c3ddoc c3d *acad*))
  28.       )
  29.     )
  30.    
  31.            (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  32.                              (if vlax-user-product-key
  33.                                (vlax-user-product-key)
  34.                                (vlax-product-key)
  35.                              )
  36.                      )
  37.                  C3D (vl-registry-read C3D "Release")
  38.                  C3D (substr C3D
  39.                              1
  40.                              (vl-string-search
  41.                                "."
  42.                                C3D
  43.                                (+ (vl-string-search "." C3D) 1)
  44.                              )
  45.                      )
  46.                  C3D (vla-getinterfaceobject
  47.                        *acad*
  48.                        (strcat "AeccXUiLand.AeccApplication." C3D)
  49.                      )
  50.            )
  51.            (setq C3Ddoc (vla-get-activedocument C3D))
  52.       )
  53.     (progn
  54.       (setq sets (vlax-get c3ddoc 'settings))
  55.       (setq sgmntcmdsets (vlax-get sets 'generalcommandssettings))
  56.       (setq sgmntlblsets
  57.              (vlax-get sgmntcmdsets
  58.                        'AddSegmentLabelSettings
  59.              )
  60.       )
  61.       (setq stylesets (vlax-get sgmntlblsets 'stylesettings))
  62.       (setq linesgmntstyle (vlax-get stylesets 'linelabelstyle))
  63.       (setq arcsgmntstyle (vlax-get stylesets 'curvelabelstyle))
  64.         (vlax-put arcsgmntstyle 'value arcstyle2use)
  65.         (vlax-put linesgmntstyle 'value linestyle2use)
  66.       (*error* nil)
  67.     )
  68.   )
  69. )
  70. [code]
  71.  
  72. [code=cadlisp-7]
  73. (defun setsurfspotlblstyle (style2use / *ACAD* C3D C3DDOC PROD PRODSTR SETS
  74.                                         SPOTLBLSETS SPOTSTYLE STYLESETS SURFCMDSETS
  75.                                         *error*)
  76.   (defun *error* (msg)
  77.     (if msg (princ (strcat "\n....error.... " msg))
  78.       )
  79.     (setq tmp (mapcar '(lambda (x)
  80.                          (vl-catch-all-apply
  81.                            'vlax-release-object (list x))
  82.                            )
  83.                       (list SPOTSTYLE STYLESETS SPOTLBLSETS SURFCMDSETS SETS c3ddoc c3d *acad*))
  84.       )
  85.     )
  86.    
  87.            (setq C3D (strcat "HKEY_LOCAL_MACHINE\\"
  88.                              (if vlax-user-product-key
  89.                                (vlax-user-product-key)
  90.                                (vlax-product-key)
  91.                              )
  92.                      )
  93.                  C3D (vl-registry-read C3D "Release")
  94.                  C3D (substr C3D
  95.                              1
  96.                              (vl-string-search
  97.                                "."
  98.                                C3D
  99.                                (+ (vl-string-search "." C3D) 1)
  100.                              )
  101.                      )
  102.                  C3D (vla-getinterfaceobject
  103.                        *acad*
  104.                        (strcat "AeccXUiLand.AeccApplication." C3D)
  105.                      )
  106.            )
  107.            (setq C3Ddoc (vla-get-activedocument C3D))
  108.       )
  109.     (progn
  110.       (setq sets (vlax-get c3ddoc 'settings))
  111.       (setq surfcmdsets (vlax-get sets 'surfacecommandssettings))
  112.       (setq spotlblsets
  113.              (vlax-get surfcmdsets
  114.                        'AddSurfaceSpotElevLabelSettings
  115.              )
  116.       )
  117.       (setq stylesets (vlax-get spotlblsets 'stylesettings))
  118.       (setq spotstyle (vlax-get stylesets 'spotelevationlabelstyle))
  119.       (vlax-put spotstyle 'value style2use)
  120.       (*error* nil)
  121.     )
  122.   )
  123. )
  124.  
  125. ;;usage, note that the label style MUST exist or it will puke
  126. ;; suggest adding error handling to help with that
  127. ;;(setsurfspotlblstyle "+NOPLOT Spot - JS")
  128.  
  129.  

To find the other settings that he asked about, I just use the COM API reference:
http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib.htm

Then search through looking for the settings for the Object type, such as AeccSettingsCommandsParcel:
http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib__IAeccSettingsCommandsParcel.htm

From there I can see which settings are available and choose which ones to address. If I want the Area label settings I would click:
http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib__IAeccSettingsCommandsParcel__AddParcelAreaLabelSettings@[out,_retval]_IAeccSettingsAddParcelAreaLabel___.htm

And so on. Note that most of the links in the COM reference will take you to the Aecc** object page where you will need to click the associated IAecc** object link. Why they did it like that, is beyond me.



cadtek

  • Guest
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #10 on: June 14, 2019, 01:51:13 PM »
This is good stuff thanks for the AeccXLandLib Library link
I am looking for the "ADDLINEBETWEENPONTS" COMMAND label style default variable.
any ideas?

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #11 on: June 15, 2019, 07:04:13 PM »
cadtek, welcome to the Swamp!

Unfortunately, Autodesk doesn't seem to want to update the COM API when new features are added. This appears to be one of the cases that we cannot access with COM. And, upon further inspection, they have neglected to expose the Style settings for both the AddMultipleSegment and AddLineBetweenPoints commands, insetad returning the LabelStyle for the plain LineSegment.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #12 on: June 19, 2019, 12:18:31 PM »
cadtek, welcome to the Swamp!

Unfortunately, Autodesk doesn't seem to want to update the COM API when new features are added. This appears to be one of the cases that we cannot access with COM. And, upon further inspection, they have neglected to expose the Style settings for both the AddMultipleSegment and AddLineBetweenPoints commands, insetad returning the LabelStyle for the plain LineSegment.
I cannot speak for AddLineBetweenPoints but you can access the multiple segment label style option with AddSegmentLabelSSettings (notice the extra S, which eluded me at first).
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #13 on: June 19, 2019, 04:16:48 PM »
You are quite right, Alan. I looked right at that and still missed it, even though I've actually used it before.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Civil3D - General Label (Dialog Box) Command line?
« Reply #14 on: June 20, 2019, 09:28:17 AM »
You are quite right, Alan. I looked right at that and still missed it, even though I've actually used it before.
It took me a minute too. I kept reading it and wondering why there were two of the same thing.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox