Author Topic: Feature Line Properties  (Read 4561 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!
Feature Line Properties
« on: April 14, 2021, 09:23:19 AM »
I was messing around with trying to get a feature line property name to the clip board. I have the base code to get the name but, not sure how to add this to the clip board.

Code: [Select]

;; Copy to Clipboard  -  Lee Mac
;; Using the same method as MP demonstrates here: http://bit.ly/170kacW
(defun LM:copytoclipboard ( str / clp htm par )
    (if (setq htm (vlax-create-object "htmlfile"))
        (progn
            (vl-catch-all-apply
               '(lambda ( )
                    (setq par (vlax-get htm 'parentwindow)
                          clp (vlax-get par 'clipboarddata)
                    )
                    (vlax-invoke clp 'setdata "Text" str)
                )
            )
            (foreach obj (list clp par htm)
                (if (= 'vla-object (type obj))
                    (vlax-release-object obj)
                )
            )
            str
        )
    )
)

(vl-load-com) (princ)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun c:flename (/ ent fle)
  (while (setq ent (entsel "\nSelect Feature Line:"))
    (setq fle (vlax-ename->vla-object (car ent)))
;;    (princ (strcat "Feature Line Name: " (vlax-get fle 'Name)))
    (LM:copytoclipboard  (strcat "(vlax-get fle 'Name)"))
;;     (LM:copytoclipboard  (strcat "(princ (strcat "Feature Line Name: " (vlax-get fle 'Name)))"))
    )
  (princ))

(C:flename)




What i am trying to do is ultimately take the feature line name, and add it into the surface as a break line name. But i thought it would be a good start to select the feature line, then right click add as breakline to surface and just ctrl-v in the name.

thanks for any help with this!
« Last Edit: April 14, 2021, 02:47:30 PM by MSTG007 »
Civil3D 2020

Rod

  • Newt
  • Posts: 185
Re: Feature Line Properties
« Reply #1 on: April 14, 2021, 08:18:25 PM »
Doslib has a function "dos_clipboard" to get or set a string to the clipboard which is pretty straightforward and what I use.

Highflyingbird also mentions a few different methods here https://www.theswamp.org/index.php?topic=38102.0;all
"All models are wrong, some models are useful" - George Box

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Feature Line Properties
« Reply #2 on: April 15, 2021, 10:15:24 AM »
Thanks Rod, I will look into it more. I think I have the basics squared away.
Civil3D 2020