Author Topic: Civil3D - Keyboard Shortcuts with Styles  (Read 6554 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil3D - Keyboard Shortcuts with Styles
« Reply #15 on: August 19, 2014, 02:22:26 PM »
Ah yes, the very obvious 10.3...  :-D
"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4094
  • C3D user & customizer
Re: Civil3D - Keyboard Shortcuts with Styles
« Reply #16 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.

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Civil3D - Keyboard Shortcuts with Styles
« Reply #17 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
    )
  )
)


Civil3D 2020