Jump to content

Recommended Posts

Posted

I have posted here in lisp as its a programming question not generic CIV3D.

 

I am trying to get into the Description key sets so I can change layer names, we are looking at a new way of processing data. Getting into CIV3D styles etc is about knowing where to look and I have done a fair bit of googling trying to find the direction up the CIV3D tree but this one I can not seem to find. It can be as easy as using the correct property name.

Posted (edited)

A bit more testing almost there starting to get at properties now.

 

Version 6 05 November 2017

 

; this is the 1st step in importing or changing description key sets in bulk
; Takes advantage of say using excel to make a csv file.
; Hard coded for file at this stage
; 1st line holds key type details must match this
; Name,Pointstyle,PointLabelStyle,Format,Layer,ScaleParameter,FixedScaleFactor,Usedrawingscale,Apply to X-Y,Apply to Z,RotationParameter,FixedRotation,RotationParameter,FixedLabelRotation,ClockwiseRotation

; http://www.cadtutor.net/forum/showthread.php?101825-Need-to-get-into-Description-key-sets-CIV3D&highlight=BIGAL

; thanks to www.Lee-mac.com for the following defuns  who has helped immensly
;csv -> list by Lee-mac
(defun _csv->lst ( str / pos )
(if (setq pos (vl-string-position 44 str))
(cons (substr str 1 pos) (_csv->lst (substr str (+ pos 2))))
(list str)
)
)

; returns *AeccDoc* for correct version of civ3d
(if (not ah:vercheck)(load "vercheck"))
(ah:vercheck)

;;-------------------=={ Parse Numbers }==--------------------;;                                                      ;;
;;  Parses a list of numerical values from a supplied string. ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;

;(if (not LM:ParseNumbers)(load "lee-macParseNumbers"))
; end of lee-mac

(defun read-keyset ( / fo )
(setq fo (open (getfiled "Select a csv File" "c:/alan/lisp/" "csv" 4) "r"))
(setq lst '())
(while
(setq keyvals (read-line fo))
(setq lst (cons (_csv->lst keyvals) lst))
(princ "\n")(princ keyvals)
)
(setq lst (reverse lst))
(close fo)
)

;  search for known key set
(defun get-addkeyset ( / )
(if (not ah:vercheck)(load "vercheck"))
(ah:vercheck)
(if (not ah:Getvals)(load "Getvals"))
(AH:GETVAL1 "Enter new or old key set name"  25 20)
(setq pdks (vlax-get-property *AeccDoc* 'pointdescriptionkeysets))
(setq ptstys (vlax-get-property *AeccDoc* 'PointStyles))
(setq ptlabstys (vlax-get-property *AeccDoc* 'PointLabelStyles))
(vlax-for keyset pdks
(if (= (vla-get-name keyset) VAL1) 
(setq foundkeys KEYSET)
(setq foundkeys (vla-add pdks val1))
)
)
)

(defun mod-keyset ( /  x excode newkey )
(setq key-type (nth 0 (nth 0 lst)))
(repeat (setq x (- (length lst) 1))
(setq excode (nth 0 (nth (setq x (- x 1)) lst)))
(setq newkey (nth 1 (nth x lst)))
(vlax-for keysinset foundkeys
(setq codename (vla-get-name keysinset))
(if (= codename excode)
(mod-keyset2 keysinset newkey )
)
)
(princ "\n")(princ x)
)
)

; returns ptstyle names
(defun ptstys ( )
(vlax-for styname ptstys
(princ (Setq ptstyname (vla-get-name styname)))(princ "\n")
(if (= ptstyname (nth 1 (nth  x lst)))(setq pstyle styname))
)
)

; returns ptstyle names
(defun ptlabstys ( )
(vlax-for styname ptlabstys
(princ (Setq ptlstyname (vla-get-name styname)))(princ "\n")
(if (= ptlstyname (nth 1 (nth  x lst)))(setq plstyle styname))
)
)

; need a add a key like xxx
; note must add keys 1st before updating all the variables
(defun add-desckeys ( / )
(vlax-for keyset pdks
(if (= (vla-get-name keyset) newkeyset) 
(setq foundkeys keyset)
)
)
(setq x 0)
(repeat (-  (length lst) 1)
(vla-add foundkeys (nth 0 (nth (setq x (+ x 1)) lst )))
)
)

; change layer example note 1st line is labels layer is 5th item
(defun chg-layer ()
(read-keyset)
(get-addkeyset)
(IF (/= foundkeys nil)
(progn
(repeat (setq x (- (length lst)1))
(setq excode (nth 0 (nth (setq x (- x 1)) lst)))
(setq newlay (nth 1 (nth x lst)))
(vlax-for keysinset foundkeys
(if (= (vla-get-name keysinset) excode)
(vla-put-layer keysinset newlay)
)
)
(princ "\n")(princ x)
)
)
(alert "No description key set foundkeys")
)
)


;(vla-put-layer  keysinset  (nth 1 (nth x lst)))

; change examplefor a known label note 1st line is labels
; Code,variable is 1st line variable becomes key-type
; 001,PSM etc 
(defun 2liner ()
(read-keyset)
(get-addkeyset)
(setq key-type (nth 1 (nth 0 lst)))
(setq x (length lst))
(repeat  (- (length lst) 1)
(setq excode (nth 0 (nth (setq x (- x 1)) lst)))
(setq newval (nth 1 (nth x lst)))
(vlax-for keysinset foundkeys
(if (=  (vla-get-name keysinset) excode )
(progn
(PRINC "\N")(PRINC X)
(cond
((= key-type "Name")(vla-put-Name keysinset  newval))
((= key-type "Format" )(vla-put-Format keysinset  newval) )
((= key-type "Layer" )(vla-put-layer keysinset  newval))
((= key-type "FixedScaleFactor" )(vla-put-FixedScaleFactor keysinset newval ))
((= key-type "Usedrawingscale" )(vla-put-Usedrawingscale keysinset  newval))
((= key-type "Apply to XY" )(vla-put-ScaleXY keysinset  newval))
((= key-type "Apply to Z" )(vla-put-ScaleZ keysinset newval))
((= key-type "FixedRotation" )(vla-put-FixedRotation keysinset  newval))
((= key-type "RotationParameter" )(vla-put-RotationParameter keysinset  newval))
((= key-type "FixedLabelRotation" )(vla-put-FixedLabelRotation keysinset  newval))
((= key-type "ClockwiseRotation" )(vla-put-layer keysinset  newval))
((= key-type "Pointstyle" ) (vlax-put-property keysinset 'PointStyle newval))
)
)
)
)
)
)


; change name of description key set foundkeys
(defun ch-namekey ( / )
(get-addkeyset )
(if (not ah:Getvals)(load "Getvals"))
(AH:GETVAL1 "Enter new or old key set name"  25 20)
(vla-put-name foundkeys  val1 )
)

; make brandnew keys
; ignore 1st line 
(defun brandnewkeys ()
(setq x 0)
(vlax-for keyset pdks
(if (= (vla-get-name keyset) foundkeys)
(repeat  (- (length lst) 1)
(vla-add keyset (nth 0 (nth (setq x (+ x 1)) lst )))
)
)
)
)

; this for a all 14 variables 
; note parameter 2 is "2" only 

(defun mod-keysall ( / )
(repeat (setq x (- (length lst) 1))
(setq excode (nth 0 (nth (setq x (- x 1)) lst)))
(vlax-for keysinset foundkeys
(setq codename (vla-get-name keysinset))
(if (= codename excode)
(progn
(setq newkey (nth 1 (nth x lst)))
;(vla-put-PointStyle keysinset newkey)
(setq newkey (nth 2 (nth x lst)))
;(vla-put-PointLabelStyle keysinset newkey)
(setq newkey (nth 3 (nth x lst)))
(vla-put-Format keysinset newkey)
(setq newkey (nth 4 (nth x lst)))
(vla-put-Layer keysinset newkey)
(setq newkey  (LM:ParseNumbers (nth 5 (nth x lst))))
(vla-put-ScaleParameter keysinset newkey)
(setq newkey (nth 6 (nth x lst)))
(vla-put-FixedScaleFactor keysinset newkey)
(setq newkey (nth 7 (nth x lst)))
(vla-put-UseDrawingScale keysinset newkey)
(setq newkey (nth 8 (nth x lst)))
(vla-put-ScaleXY keysinset newkey)
(setq newkey (nth 9 (nth x lst)))
(vla-put-ScaleZ keysinset newkey)
(setq newkey (LM:ParseNumbers (nth 10 (nth x lst))))
(vla-put-RotationParameter keysinset newkey)
(setq newkey (nth 11 (nth x lst)))
(vla-put-RotationParameter keysinset newkey)
(setq newkey (nth 12 (nth x lst)))
(vla-put-LabelRotationParameter keysinset newkey)
(setq newkey (nth 13 (nth x lst)))
(vla-put-FixedLabelRotation keysinset newkey)
(setq newkey (nth 14 (nth x lst)))
(vla-put-ClockwiseRotation keysinset newkey)
)
)
)
)

; this for a 2 variable csv not a all 14 variables 
; code,name,variable 
(defun mod-keyinset2 ( keysinset newkey / )
(setq key-type (nth 1 (nth  0 lst)))
(repeat (setq x (- (length lst) 1))
(cond
((= key-type "Name")(vla-put-Name keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
;((= key-type "Pointstyle" )(vla-put-pointstyle keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
;((= key-type "PointLabelStyle" )(vla-put-PointLabelStyle keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
((= key-type "Format" )(vla-put-Format keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
((= key-type "Layer" )(vla-put-layer keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
((= key-type "ScaleParameter" )(vla-put-ScaleParameter keysinset (LM:ParseNumbers  (nth 1 (nth  (setq x (- x 1)) lst))))))
((= key-type "FixedScaleFactor" )(vla-put-FixedScaleFactor keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
((= key-type "Usedrawingscale" )(( if (= (nth 1 (nth  (setq x (- x 1)) lst) "Yes")(setq ans -1)(setq ans 0)) (vla-put-Usedrawingscale keysinset ans )))
((= key-type "Apply to XY" )(( if (= (nth 1 (nth  (setq x (- x 1)) lst) "Yes")(setq ans -1)(setq ans 0))(vla-put-ScaleXY keysinset ans )))
((= key-type "Apply to Z" )(( if (= (nth 1 (nth  (setq x (- x 1)) lst) "Yes")(setq ans -1)(setq ans 0))(vla-put-ScaleZ keysinset  ans)))
((= key-type "RotationParameter" )(vla-put-RotationParameter keysinset (LM:ParseNumbers (nth 1 (nth  (setq x (- x 1)) lst))))))
((= key-type "FixedRotation" )(vla-put-FixedRotation keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
((= key-type "RotationParameter" )(vla-put-RotationParameter keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
((= key-type "FixedLabelRotation" )(vla-put-FixedLabelRotation keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
((= key-type "ClockwiseRotation" )(vla-put-layer keysinset  (nth 1 (nth  (setq x (- x 1)) lst)))))
)
)
)

; put test stuff here
(defun dummy ()
; pointstyle stuff
(vlax-for keysinset foundkeys
(setq ps   keysinset)
)
(setq ptsy (vlax-get-property ps 'pointstyle))
(setq name (vla-get-name ptsy)) ; use this to match

(vlax-put-property ptsy 'Name "001")  ; not working need a solution

; IAeccPointDescriptionKey: IAeccPointDescriptionKey Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 0000026102c05c50>
; 14 ClockwiseRotation = 0
;   Document (RO) = #<VLA-OBJECT IAeccDocument 0000026102c05950>
;   13 FixedLabelRotation = 0.0
; 11  FixedRotation = 0.0
; 6  FixedScaleFactor = 1.0
; 3  Format = "PSM"
;   Handle (RO) = "9F15"
;   HasExtensionDictionary (RO) = 0
;  12  LabelRotationParameter = 2
; 4  Layer = "SU_PSM"
; 0  Name = "001*"
;   ObjectID (RO) = 44
;   ObjectName (RO) = "AeccDbPointDescKey2"
;   OverrideFixedRotation = 0
;   OverrideFixedScaleFactor = 0
;   OverrideLabelFixedRotation = 0
;   OverrideLabelRotationParameter = 0
;   OverrideLayer = -1
;   OverridePointLabelStyle = -1
;   OverridePointStyle = -1
;   OverrideRotationParameter = 0
;   OverrideScaleParameter = 0
;   OwnerID (RO) = 43
; 2   PointLabelStyle = #<VLA-OBJECT IAeccLabelStyle 000002617d62d790>
; 1  PointStyle = #<VLA-OBJECT IAeccPointStyle 000002617ed83110>
; 10 RotationParameter = 2
; 5  ScaleParameter = 1
; 8   ScaleXY = 0
; 9   ScaleZ = 0
; 7 UseDrawingScale = -1

; test for names
(vlax-for keysinset foundkeys
(princ (vla-get-NAME keysinset))
)


(setq ptsy (vlax-get-property keyinset 'pointstyle))
(setq name (vla-get-name ptsy)) ; use this to match
(setq ptsy (vlax-get-property ps 'pointstyle))
#<VLA-OBJECT IAeccPointStyle 0000029a1bbe7ae0>

Command: (vlax-dump-object ptsy)
; IAeccPointStyle: IAeccPointStyle Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 0000029a21c436e0>
;   CreatedBy = "autodesk"
;   CustomMarkerStyle = 3
;   CustomMarkerSuperimposeStyle = 0
;   DateCreated (RO) = "8/29/2004 5:05:52 AM"
;   DateModified (RO) = "6/18/2007 5:33:36 PM"
;   Description = "Metric Standard Style"
;   Display3dType = 0
;   Document (RO) = #<VLA-OBJECT IAeccDocument 0000029a21c43bf0>
;   Elevation = 0.0
;   Handle (RO) = "1AA"
;   HasExtensionDictionary (RO) = 0
;   LabelDisplayStyleModel (RO) = #<VLA-OBJECT IAeccDisplayStyle 0000029a21c43e60>
;   LabelDisplayStylePlan (RO) = #<VLA-OBJECT IAeccDisplayStyle 0000029a21c44a60>
;   MarkerDisplayStyleModel (RO) = #<VLA-OBJECT IAeccDisplayStyle 0000029a21c43d70>
;   MarkerDisplayStylePlan (RO) = #<VLA-OBJECT IAeccDisplayStyle 0000029a21c449a0>
;   MarkerFixedScale = (1.0 1.0 1.0)
;   MarkerRotationAngle = 0.0
;   MarkerSize = 0.05
;   MarkerSizeType = 2
;   MarkerSymbolName = ""
;   MarkerType = 1
;   Name = "Standard"
;   ObjectID (RO) = 319
;   ObjectName (RO) = "AeccDbPointStyle"
;   OrientationReference = 1
;   OwnerID (RO) = 320
;   ScaleFactor = 1.0

) ; dummy defun

 

;vercheck.lsp  version check for *aecc objects


(defun ah:vercheck ( / vrsn appstr)
(vl-load-com)

(setq vrsn (vlax-product-key))
       (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"));;2014
        ((vl-string-search "R20.0" vrsn)(setq appstr "10.4"));;2015
        ((vl-string-search "R20.1" vrsn)(setq appstr "10.5"));;2016     
        ((vl-string-search "R21.0" vrsn)(setq appstr "11.0"));;2017   
        ((vl-string-search "R22.0" vrsn)(setq appstr "12.0"));;2018
       )
(if (= appstr nil)
(progn (alert "This version of civ3d not supported\nNow exiting") (exit)
)
)

(setq *AeccDoc* (vla-get-activedocument
(vla-getinterfaceobject
(vlax-get-acad-object)
(Strcat "AeccXUiLand.AeccApplication." appstr)
)
)
)
)

 

; Input  Dialog box with variable title
; multiple lines of dcl input supported
; add extra lines if required by copying code defun
; By Alan H 2015
(vl-load-com)

; 1 line dcl
; sample code (ah:getval1 "Line 1" 5 4)
(defun AH:getval1 (title width limit / fo fname)
; you can hard code a directory if you like for dcl file
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
(write-line "ddgetval : dialog {" fo)
(write-line " : row {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = "  (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title (chr 34) ";"  )   fo)
; these can be replaced with shorter value etc
(write-line (strcat "     edit_width = " (rtos width 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit 2 0) ";" ) fo)
(write-line "   is_enabled = true;" fo)
(write-line "    }" fo)
(write-line "  }" fo)
(write-line "ok_only;}" fo)
(close fo)

(setq dcl_id (load_dialog  fname))
; pt is a list 2 numbs -1 -1 centre ('(20 20))
;(not (new_dialog "test" dch "" *screenpoint*)) 
(if (not (new_dialog "ddgetval" dcl_id))
(exit))
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key1" 3)
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 as a string
(vl-file-delete fname)
) ; defungetval1

; 2 line dcl
; sample code (ah:getval2 "Line 1" 5 4 "Line2" 8 7)
(defun AH:getval2 (title1 width1 limit1 title2 width2 limit2 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
;(setq fname (strcat (getvar "SAVEFILEPATH") "\\getval2.dcl"))
;(setq fo (open fname "w"))
(write-line "ddgetval2 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)

; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval2" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 and val2 as strings
(vl-file-delete fname)
) ; defungetval2

; 3 line dcl
; sample code (ah:getval3 "Line 1" 5 4 "Line 2" 8 7 "Line 3" 6 4)

(defun AH:getval3 (title1 width1 limit1 title2 width2 limit2 title3 width3 limit3 / fo fname)
(setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w"))
;(setq fname (strcat (getvar "SAVEFILEPATH") "\\getval3.dcl"))
;(setq fo (open fname "w"))
(write-line "ddgetval3 : dialog {" fo)
(write-line " : column {" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key1" (chr 34) ";") fo)
(write-line  (strcat " label = "  (chr 34) title1 (chr 34) ";" ) fo)
(write-line (strcat "     edit_width = " (rtos width1 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit1 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key2" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title2 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width2 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit2 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line ": edit_box {" fo)
(write-line (strcat "    key = " (chr 34) "key3" (chr 34) ";") fo)
(write-line (strcat " label = "  (chr 34) title3 (chr 34) ";"  ) fo)
(write-line (strcat "     edit_width = " (rtos width3 2 0) ";" ) fo)
(write-line (strcat "     edit_limit = " (rtos limit3 2 0) ";" ) fo)
(write-line "   is_enabled = true ;" fo)
(write-line "    }" fo)
(write-line "    }" fo)
(write-line "spacer_1 ;" fo)
(write-line "ok_only;}" fo)
(close fo)

; code part
(setq dcl_id (load_dialog  fname))
(if (not (new_dialog "ddgetval3" dcl_id))
(exit))
(mode_tile "key1" 3)
(action_tile "key1" "(setq val1 $value)")
(mode_tile "key2" 3)
(action_tile "key2" "(setq val2 $value)")
(mode_tile "key3" 3)
(action_tile "key3" "(setq val3 $value)")
(start_dialog)
(done_dialog)
(unload_dialog dcl_id)
; returns the value of val1 val2 and val3 as strings
(vl-file-delete fname)
) ; defungetval3

Edited by BIGAL
Posted

Hi BIGAL,

Are you sure that 'Item is a property and not a method?

 

(repeat (setq i (cond ((ErrorTrap 'vlax-get-property (list found 'Count)))(0)))
 (setq L
   (cons
     (vlax-invoke-method found 'Item (setq i (1- i)))
     L
   )
 )
)

(defun ErrorTrap ( f args / r )
 (cond
   ( (vl-catch-all-error-p (setq r (vl-catch-all-apply f args))) 
     (prompt (strcat "\nError: " (vl-catch-all-error-message r))) 
   )
   (r)
 )
)

 

BTW some times vlax-for doesn't work so I use repeat iteration - that happened to me once, while I was scripting into some application.

Posted

Thanks Grr yeah woke up in middle of night and went oh yeah use vlax-for so now on to part two I have updated code and it now goes to the level required.

 

I should have mentioned at the start that its about CIV3D not having the ability to import description key sets you can export but not import which is a big problem at times.

Posted
Thanks Grr yeah woke up in middle of night and went oh yeah use vlax-for so now on to part two I have updated code and it now goes to the level required.

 

No problem BIGAL, I'm happy to help out back!

Sometimes I have sleep difficulties aswell, due figuring out different ideas and solutions while in bed. :lol:

So I always keep a piece of paper to quickly write down what I was thinking so I won't regret forgeting it the next day.

 

I should have mentioned at the start that its about CIV3D not having the ability to import description key sets you can export but not import which is a big problem at times.

 

I never used CIV3D, but if the description's data represents a text/numbers you could try to lisp-read it from the export to a list and then iterate over the drawing to apply that certain properties'n'methods.

Posted

I have updated the sample code above as a work in progress, can create a new Description set and add new keys so next step is to add the extra properties, pretty closed to cracked it.

 

This has been a thorn in the side for CIV3d users for years that Autodesk would not adress.

ScreenShot067.jpg

Posted
I should have mentioned at the start that its about CIV3D not having the ability to import description key sets you can export but not import which is a big problem at times.

 

In versions I've used you can drag+drop or copy and paste Description Key Sets: https://knowledge.autodesk.com/support/autocad-civil-3d/troubleshooting/caas/sfdcarticles/sfdcarticles/Transferring-or-copying-an-existing-description-key.html

Posted (edited)

Fully understand tombu but if I want to make a brand new one with 276 new codes I have to do every code line one at a time and there are 14 variables per line, some need to be changed others can be default 3,864 entries. Importstyles does a similar thing.

 

You can copy your codes out but not paste back in, 2019 ?

 

I have it almost done so you can actually start a brand new description set from excel. I am looking at about 4 options, export out a key set, create new key set, add to key set, change an item/s in existing key set. The last takes about 1 second to change all the layers for 276 codes. It took about 2 mins to make a csv file, exporting out an existing key set into excel a quick concatenate, a paste to notepad yes notepad to change the * to *, making the two variable csv required code,layername. It was quicker to dump into notepad than write a macro in excel as it picks up on the * as a wild card.

 

This is something that has bugged me for a long time, the inability to do simple bulk changes to codes. Just taken for granted in other software from the 1st day.

 

Despite its influence there is a lot of "It would be nice in CIV3D" that is in my 20 year OLD software and lots of other 20 year old software.

Edited by BIGAL
Posted

That's some pretty cool code, looking forward to seeing it when you're done. By reordering the description key sets I use drawings can be modified to display for various purposes. I copied each of those keys between them the hard way so I see where you're coming from.

  • 2 weeks later...
Posted (edited)

For any one interested please have a look at the code above its still a work in progress doing front end and testing.

 

Adds a new key name but blank entries

Adds codes to new keyset

Up dates an item based on code name and description eg layer new or existing key set

Renames key description

In progress is a full upload of as many keys as you want including all 15 variables from a csv.

 

Watch this space again I have updated code getting close. Needs some testing and a good front end.

Edited by BIGAL
  • 2 weeks later...
Posted

Well I am getting there and pretty close to finishing the defuns to do stuff I am having a little problem each description key has a Labelstyle which is a seperate set of style again like the description key sets. Civ3d is so intertwined.

 

I need some help there are 2 items I can not seem to change out of the 14 that make a key record.

 

I can dump a description key

PointLabelStyle = #

PointStyle = #

 

then going further

(setq ptsy (vlax-get-property keyinset 'pointstyle))

(setq name (vla-get-name ptsy)) ; use this to match the label style

(setq ptstyle (vlax-get-property ptsy 'pointstyle))

#

 

a dump

(vlax-dump-object ptsy)

; IAeccPointStyle: IAeccPointStyle Interface

; Property values:

; Application (RO) = #

; CreatedBy = "autodesk"

; Description = "Metric Standard Style"

; Display3dType = 0

; Document (RO) = #

; LabelDisplayStyleModel (RO) = #

; LabelDisplayStylePlan (RO) = #

; MarkerDisplayStyleModel (RO) = #

; MarkerDisplayStylePlan (RO) = #

; MarkerRotationAngle = 0.0

; MarkerSize = 0.05

; MarkerSizeType = 2

; MarkerSymbolName = ""

; MarkerType = 1

; Name = "Standard"

; ObjectID (RO) = 319

; ObjectName (RO) = "AeccDbPointStyle"

; OrientationReference = 1

; OwnerID (RO) = 320

 

I need to change the "Name" to a known label style name I know its part of the property to do this but I am stuck.

 

Hope this makes sense unfortunately you need CIV3d to see the label styles.

  • 2 weeks later...
Posted (edited)

Starting to get it all working the priority that we wanted now works to change a certain column of values.

 

Just going through each column checking its working.

 

solved a style problem hopefully

 

; just need to change the string to correct string
((= key-type "Pointstyle" ) (vlax-put-property keysinset 'PointStyle "012"))

Edited by BIGAL
  • Like 1
  • 1 month later...
Posted

Big AL,

 

have you managed to resolve the pointstyle name problem? I am trying to build a routine for a legend using the point styles of the cogo points. when I get the names of the point style I am getting the same value #

Posted

ok i got it solved, i hope this helps.

 

(setq pntstyle (vlax-get point 'style)) 
       (setq pntName (vlax-get-property pntstyle 'name))

Posted

I had got around it as per code above as I was setting not retrieving. The CIV3d styles are just so intertwined.

 

The routine was working for me to do what I wanted and when I get time will finish it off with a front end. I will check 2018 and see if you can paste back in not just out.

  • 1 year later...
Posted
On 9/30/2017 at 2:56 AM, BIGAL said:

I have updated the sample code above as a work in progress, can create a new Description set and add new keys so next step is to add the extra properties, pretty closed to cracked it.

 

This has been a thorn in the side for CIV3d users for years that Autodesk would not adress.

ScreenShot067.jpg

 Can anyone of you be so kind and post the complete routine???... please

Posted

What do you want to do ?

Are you trying to create a description set from nothing ?

You have to understand the values required thats why use excel to copy columns.

 

It will take a csv file from excel and import it into a style. I am happy to help as I want to finish the code properly.

 

For me I need a dwg that you want the descriptions added to and an excel set up correct. You can export the keys but not import.

 

  • 5 weeks later...
Posted

Can you upload a video or a set of instructions for this app?

Posted

Its best to understand what your trying to do, I started it to add description keys from scratch. Or change the keys.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...