TheSwamp
CAD Forums => Vertically Challenged => Land Lubber / Geographically Positioned => Topic started by: MSTG007 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.
;; 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!
-
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 (https://www.theswamp.org/index.php?topic=38102.0;all)
-
Thanks Rod, I will look into it more. I think I have the basics squared away.