TheSwamp

CAD Forums => Vertically Challenged => Land Lubber / Geographically Positioned => Topic started by: MSTG007 on August 19, 2014, 07:39:26 AM

Title: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 07:39:26 AM
Ok. I have another brain storm. I know I could probably use this for other things with styles, but for now it is geared to surfaces. I would like to be able to type in a (SF1) which would take the surface style to a (No Display), or (SF2) which would show the surface style to (Contours). So my questions is there away I can say a command then in the script or lisp type is what they would equal?

example
SF1   No Display
SF2   Contours
SF3   Triangles
SF4   Slope Arrows


The reason I am asking it to be like this is for easy customization if the user changes a style name he can then go into the lisp and update what command should equal.

It would be cool to do this with pipe styles too.

Just a thought.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: mjfarrell on August 19, 2014, 08:46:43 AM
I'm having a brain storm right here...

Quote
if the user changes a style name he can then go into the lisp and update what command should equal


can't even imagine the lost productivity created by users randomly changing style names...

how does anyone know what anything ever really is?

and then add in the admin of editing some lisp file to keep up with an ever growing menagerie of object style names....


in a best practice environment one is not constantly changing, nor introducing new random style names


just say no to this....
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 08:53:22 AM
Michael, Hey I see what you are saying. Within our production environment, we have a set number of styles we use. For us, that does not change.

I was making a suggestion for if other people in the forum want to customize the lisp that they can.

I hope that clears up the confusion.

Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: Jeff_M on August 19, 2014, 09:07:54 AM
Here's a video\showing the Surface Display Toggle I added to the Sincpac-C3D earlier this year. Yes, it alters the display properties of the current style, but it records the original status and has the option to reset it back to the original display. Even if the drawing is saved, closed, reopened, the original state can be restored. This is real handy during design and or editing existing ground in detailed areas.

https://chronicle.autodesk.com/Main/Details/360872b7-8a13-4d69-bd69-d28a3370a287
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 09:09:00 AM
Thank you Jeff, Again you are DAH man!
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: mjfarrell on August 19, 2014, 09:10:08 AM
from that perspective...it could have some value....

my first read of it, was like inviting vampires, zombies, and changelings to dinner....

interesting for the first few minutes


and then nothing more than chaos and mayhem
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 10:14:05 AM
Again, I apologize about that. Sometimes (I) have all these ideas and you just start typing and expect what I type is clear... but later find out its no clearer than mud. So again, Sorry about that. But I do think this idea is good one. I don't know how many times a person Right clicks to edit or change a style thru there day.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: mjfarrell on August 19, 2014, 11:13:54 AM
Again, I apologize about that. Sometimes (I) have all these ideas and you just start typing and expect what I type is clear... but later find out its no clearer than mud. So again, Sorry about that. But I do think this idea is good one. I don't know how many times a person Right clicks to edit or change a style thru there day.
Process fault....
Changing style = good

Editing Style = not so good

for clarity....one should have a style for nearly every purpose in Template

Then the user need only change the style to achieve the desired result (effect-drafted output)
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: sdunn on August 19, 2014, 12:21:14 PM
We took the approach of having buttons that allows the user to swap styles for surfaces depending on what they need to see.  We have 42 styles to accomplish this and the automation is done via lisp.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 12:23:03 PM
Nice... That is very similar to what I am looking for... Something like that.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 01:06:01 PM
I found something that look like it might work. However, I am getting a LOAD Failed: "vercheck". We are using 2014. I was looking thru the lisp to try to update the version but that is not working either.

Thanks for any help!

http://www.cadtutor.net/forum/showthread.php?49417-Changing-CIV3d-contours-simply/page2 (http://www.cadtutor.net/forum/showthread.php?49417-Changing-CIV3d-contours-simply/page2)

The attachment is from the web site above.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: sdunn on August 19, 2014, 01:42:30 PM
Use 10.3 for version 2014

         ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
         ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
         ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
         ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12
         ((vl-string-search "R18.2" vrsn) (setq appstr "10.0")) ;13
         ((vl-string-search "R18.2" vrsn) (setq appstr "10.3")) ;14
         ((vl-string-search "R18.2" vrsn) (setq appstr "10.4")) ;15
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 01:54:36 PM
Tried it... no luck.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: sdunn on August 19, 2014, 02:15:19 PM
Sorry about that.  I forgot to change the Acad versions

         ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
         ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
         ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
         ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12
         ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13
         ((vl-string-search "R19.1" vrsn) (setq appstr "10.3")) ;14
         ((vl-string-search "R20.0" vrsn) (setq appstr "10.4")) ;15

I did test it with 2013 by adding the files to my support path and loading them manually.  I used the readme to create a command by cutting and pasting this into the command line:

(defun c:cc ()(load "vercheck")(load "listselect")(load "changecontours6")
)

You will get a dialog that shows the surfaces in the drawing and then a list of styles to choose from.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 02:21:14 PM
Updated and still a no go. . . its ok. At least its something to work with. thank you.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: BlackBox on August 19, 2014, 02:22:26 PM
Ah yes, the very obvious 10.3 (http://knowledge.autodesk.com/support/autocad-civil-3d/troubleshooting/caas/discussion/t5/AutoCAD-Civil-3D-General/What-is-the-AeccXUiLand-AeccApplication-version-for-Civil-3D/td-p/4381288.html)...  :-D
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: Jeff_M on August 19, 2014, 02:27:11 PM
Updated and still a no go. . . its ok. At least its something to work with. thank you.
The error is "LOAD Failed..." which means it is not even finding the lisp to load. Make sure all of the lisp files are in the support path so AutoCAD can find them.
Title: Re: Civil3D - Keyboard Shortcuts with Styles
Post by: MSTG007 on August 19, 2014, 02:29:14 PM
Well, Here is the full code:

Code: [Select]
;vercheck.lsp  version check for *aecc objects


(defun ah:vercheck ()
(vl-load-com)

(if ((lambda (vrsn)
        (cond
         ((vl-string-search "R17.2" vrsn) (setq appstr "6.0")) ;09
         ((vl-string-search "R18.0" vrsn) (setq appstr "7.0")) ;10
         ((vl-string-search "R18.1" vrsn) (setq appstr "8.0")) ;11
         ((vl-string-search "R18.2" vrsn) (setq appstr "9.0")) ;12
         ((vl-string-search "R19.0" vrsn) (setq appstr "10.0")) ;13
         ((vl-string-search "R19.1" vrsn) (setq appstr "10.3")) ;14
         ((vl-string-search "R20.0" vrsn) (setq appstr "10.4")) ;15
        ((alert "This version of C3D not supported!"))
        )
       )
       (vlax-product-key)
      )                         ; end if condition progn is true
      (progn
        (cond (*AeccDoc*)
          ((setq *AeccDoc*
            (vlax-get
              (cond (*AeccApp*)
                ((setq *AeccApp*
                  (vla-getinterfaceobject
                     (cond (*Acad*)
                     ((setq *Acad* (vlax-get-acad-object)))
                     )
                     (strcat "AeccXUiLand.AeccApplication." appstr)
                  )
                 )
                )
              )
              'ActiveDocument
            )
           )
          )
        ) ; end main cond
      ) ; end progn
) ; end if vsrn
)

Code: [Select]
;(defun c:Surface (/ appstr lst )

  ;; Assign new style to selected Civil 3D surfaces
  ;; Required Subroutines: AT:ListSelect
  ;; Alan J. Thompson, 06.22.10
  ;; Modified by Alan H Jan 2011

(vl-load-com)

(ah:vercheck)  ; version check see vercheck.lsp
     
(vlax-for j (vlax-get *AeccDoc* 'SurfaceS)
(setq lst (cons (cons (vla-get-name j) j) lst))
)

;if length of surfaces more than 1 else skip pick  if  0 then msg and exit
(setq lenlst (length lst))

(if (= lenlst 0)
    (progn
    (Getstring "\nYou have no surfaces press any key to exit")
    (exit)
    )
)


(if (= lenlst 1)
  (setq surfacepick (car (nth 0 lst)))  ; pull surface out of dotted pair
)

(if (> lenlst 1)
  (progn
  (setq surfacepick (car (AT:ListSelect
    "Set new surface "
    "Select surface name"
    10
    10
    "false"
    (vl-sort (mapcar (function car) lst) '<)
  )))
  ) ; end progn 
) ;end if

(setq lst2 lst)     ; make answer returned list2

(setq lst '())

; make a list of surface styles names if not pre picked

(vlax-for i (vlax-get *AeccDoc* 'SurfaceStyles)
  (setq lst (cons (cons (vla-get-name i) i) lst))
)

(if (= surface nil)
     (progn
     (setq surface (car (AT:ListSelect
                                    "Set new surface style"
                                    "Select style"
                                    10
                                    10
                                    "false"
                                    (vl-sort (mapcar (function car) lst) '<)
                                  ) )
     )   ; end setq
(princ surface)
     )   ;end progn
)           

(vlax-for k (vlax-get *AeccDoc* 'SurfaceS)
    (if (= Surfacepick (vla-get-name k))             ;match surface
    (vlax-put k 'Style (cdr (assoc surface lst)))
    ) ; end if
 )   ; end vlax-for

(setq lst '())

(setq surfacepick nil
          surface nil
          lenlst nil)

(princ)  ; exit quietly





Code: [Select]
(defun AT:ListSelect (title label height width multi lst / fn fo d item f)
  ;; List Select Dialog (Temp DCL list box selection, based on provided list)
  ;; title - list box title
  ;; label - label for list box
  ;; height - height of box
  ;; width - width of box
  ;; multi - selection method ["true": multiple, "false": single]
  ;; lst - list of strings to place in list box
  ;; Alan J. Thompson, 09.23.08 / 05.17.10 (rewrite)
  (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w"))
  (foreach x (list (strcat "list_select : dialog { label = \"" title "\"; spacer;")
                   (strcat ": list_box { label = \"" label "\";" "key = \"lst\";")
                   (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";")
                   (strcat "width = " (vl-princ-to-string width) ";")
                   (strcat "multiple_select = " multi "; } spacer; ok_cancel; }")
             )
    (write-line x fo)
  )
  (close fo)
  (new_dialog "list_select" (setq d (load_dialog fn)))
  (start_list "lst")
  (mapcar (function add_list) lst)
  (end_list)
  (setq item (set_tile "lst" "0"))
  (action_tile "lst" "(setq item $value)")
  (setq f (start_dialog))
  (unload_dialog d)
  (vl-file-delete fn)
  (if (= f 1)
    ((lambda (s / i s l)
       (while (setq i (vl-string-search " " s))
         (setq l (cons (nth (atoi (substr s 1 i)) lst) l))
         (setq s (substr s (+ 2 i)))
       )
       (reverse (cons (nth (atoi s) lst) l))
     )
      item
    )
  )
)