where is/name of the match properties .lsp file ?

where is/name of the match properties .lsp file ?

yairMSKTU
Enthusiast Enthusiast
940 Views
8 Replies
Message 1 of 9

where is/name of the match properties .lsp file ?

yairMSKTU
Enthusiast
Enthusiast

i want to learn / make my own lisps based on existing ones i use alot.

where can i find the match properties .lsp ?

is there a website with the default commands files list, to make it easier for users to find ?

0 Likes
941 Views
8 Replies
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant

If you follow up on your question from last week, THIS routine could solve your issue or at least help to solve it.

 

Lee's website is worth exploring, one of the best public libraries we have. But... for learning, in general, is probably better to start HERE. Lee's programs might be too advanced to learn from.

 

Also, the good resource with many examples, I think even with a tutorial, is HELP 

 

Z9E3zK5E_0-1636283189851.png

 

Lastly, just to be clear. The built-in commands as MATCHPROP are not distributed as *.lsp files. They are not adjustable. You can use them in your LISP routines just as a black box. Contrarily some of Express Tools ARE LISPs, see in help where the files are stored. But still, see their copyrights.

0 Likes
Message 3 of 9

yairMSKTU
Enthusiast
Enthusiast

i have some history with basic java and c+ and scripts so i can understand these basics.

 

the idea is to create a sort of match properties with settings of "text", but add to it a specific custom text style, which is not the same from the source text.

 

so the idea is to take the match properties lisp and add to it a few lines for that plot style. 

im almost done with my work,  but im sure something like that would help me in the future.

0 Likes
Message 4 of 9

john.uhden
Mentor
Mentor

I have thought about that myself because not every property gets matched.

So I think you have to build a list of all the properties that can be, eg.

(setq littany '(height width textstring layer color etc. etc.))

and then

 

(foreach property littany
  (if 
    (and
      (vlax-property-available-p source property)
      (vlax-property-available-p target property)
    )
    (vlax-put target 'property (vlax-get source 'property))
  )
)

 

Looks simple, right?  BUT in many cases the property of one object type may not be named the same as the same property of another object type.  AND you can't put areas and lengths,  AND you shouldn't put textstrings, or insertion points, or coordinates, or northings and eastings, and elevations.  AND probably thousands of other caveats that leave my mind boggled.

But what the heck; give it a shot.  Best of luck.

John F. Uhden

0 Likes
Message 5 of 9

Sea-Haven
Mentor
Mentor

Dumpit.lsp is your friend.

;;;===================================================================; 
;;; DumpIt                                                            ; 
;;;-------------------------------------------------------------------; 
;;; Dump all methods and properties for selected objects              ; 
;;;===================================================================; 
(defun C:Dumpit ( / ent) 
  (while (setq ent (entsel)) 
    (vlax-Dump-Object 
      (vlax-Ename->Vla-Object (car ent)) 
    ) 
  ) 
  (princ) 
)

 

This is something I worked on as Library function get what you want from an object. Look at bottom for examples.

 

; properties use as a library function
; By Alan H july 2020

(defun cords (obj / co-ords xy )
(setq coordsxy '())
(setq co-ords (vlax-get obj 'Coordinates))
(setq numb (/ (length co-ords) 2))
(setq I 0)
(repeat numb
(setq xy (list (nth (+ I 1) co-ords)(nth I co-ords) ))
(setq coordsxy (cons xy coordsxy))
(setq I (+ I 2))
)
)


(defun AH:chkcwccw (obj / lst newarea)
(setq lst (CORDS obj))
(setq newarea
(/ (apply (function +)
            (mapcar (function (lambda (x y)
                                (- (* (car x) (cadr y)) (* (car y) (cadr x)))))
                    (cons (last lst) lst)
                    l)) 
2.)
)
(if (< newarea  0)
(setq cw "F")
(setq cw "T")
)
)

; Can use reverse in Autocad - pedit reverse in Bricscad.

(defun plprops (obj txt / lst)
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vla-get-layer obj)))
((= (strcase val) "AREA")(setq area (vla-get-area obj)))
((= (strcase val) "START")(setq start (vlax-curve-getstartpoint obj)))
((= (strcase val) "END" (strcase txt))(setq end (vlax-curve-getendpoint obj)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Length)))
((= (strcase val) "CW" (strcase txt))(AH:chkcwccw obj))
((= (strcase val) "CORDS" (strcase txt))(CORDS obj))
)
)
)

(defun lineprops (obj lst / )
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vlax-get obj 'layer)))
((= (strcase val) "START")(setq start (vlax-get obj 'startpoint)))
((= (strcase val) "END" (strcase txt))(setq end (vlax-get obj 'endpoint)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Length)))
)
)
)

(defun circprops (obj lst / )
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vlax-get obj 'layer)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Circumference)))
((= (strcase val) "RAD" (strcase txt))(setq rad (vla-get-radius obj)))
((= (strcase val) "CEN" (strcase txt))(setq cen (vlax-get obj 'Center)))
((= (strcase val) "AREA" (strcase txt))(setq end (vlax-get obj 'AREA)))
)
)
)

(defun arcprops (obj txtlst)
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vlax-get obj 'layer)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'length)))
((= (strcase val) "RAD" (strcase txt))(setq rad (vla-get-radius obj)))
((= (strcase val) "CEN" (strcase txt))(setq cen (vlax-get obj 'Center)))
((= (strcase val) "START" (strcase txt))(setq area (vlax-get obj 'startpoint)))
((= (strcase val) "END" (strcase txt))(setq area (vlax-get obj 'endpoint)))
((= (strcase val) "AREA" (strcase txt))(setq end (vlax-get obj 'AREA)))
)
)
)

; starts here
(setq ent (vlax-ename->vla-object (car (entsel "Pick Object "))))
; do a check for object type then use defun
; pick an example below


; many examples copy to command line for testing mix and match 
; (plprops ent '("LAY"))(princ lay)
; (plprops ent '("END"))(princ end)
; (plprops ent '("START"))(princ start)
; (plprops ent '("END" "START"))(princ end)(princ start)
; (plprops ent '("AREA" "LAY" "END" "START"))(princ area)(princ lay)(princ end)(princ start)
; (plprops ent '("START" "AREA" "LAY" "CW"))(princ start)(princ area)(princ cw)
; (plprops ent '("start" "END" "CORDS" "cw"))(princ start)(princ end)(princ coordsxy)(princ cw)
; (plprops ent '("CW"))(princ cw)
; (plprops ent '("AREA"))(princ area)
; (plprops ent '("CORDS"))(princ coordsxy)
; (lineprops ent "len"))(princ len)
; (lineprops ent '("len" "lay"))(princ len)(princ lay)
; (lineprops ent '("lay" "end" "start" "len"))(princ len)(princ lay)(princ start)(princ end)
; (circprops ent '("lay" "rad" "area" "cen"))(princ lay)(princ rad)(princ area)(princ cen)
; (circprops ent '("lay" "rad"))
; (arcprops ent '("lay" "rad"))




 

0 Likes
Message 6 of 9

john.uhden
Mentor
Mentor
Nice, Alan. Well organized.
Too bad I was impatient and copied your code from my e-mail, thereby having
to add all the indentation.
Anyway, I think you need to change...
(defun arcprops (obj txtlst)
to
(defun arcprops (obj lst)

John F. Uhden

0 Likes
Message 7 of 9

Sea-Haven
Mentor
Mentor

Thanks will fix, if I could edit post would fix here also silly 30 minute timer.

0 Likes
Message 8 of 9

john.uhden
Mentor
Mentor
Well, if it takes you that long until you realize an error, then ...
.
Hey, that's why the rest of us are here... to notice little mistakes,
that's all.
Meanwhile, why didn't you notice that I went out with the wrong car
keys this morning? 🤔

John F. Uhden

0 Likes
Message 9 of 9

ВeekeeCZ
Consultant
Consultant

Well, let me advise you, actually you can edit your posts as much as you want. Times has changed.

0 Likes