alanjt 发表于 2022-7-6 10:18:00

The part you didn't code for him.

Lee Mac 发表于 2022-7-6 10:23:34

 
Most likely.
 
I'm still puzzled by this..
 

Michaels 发表于 2022-7-6 10:25:48

Lee .
 
My poor experience with lisp forced me to copy and paste things like that sometimes .
 
And what is the logic of these Men's codes ?
 
Is it one man way or experts' way ? 
I promise you that I would get my won way when I become at least able to write small routine .
 
Michaels

pBe 发表于 2022-7-6 10:28:44

This makes it easy to determine functions that have been developed by you in support of the main code
 
-Good Habits for Coding in Visual LISP® - Robert Bell -

Michaels 发表于 2022-7-6 10:31:08

 
I did not get the point well!

pBe 发表于 2022-7-6 10:36:43

In programming in general. its always a good practice to make names of routines as long as necessary that clearly describes everything the routine does (a description of the return value)
as for adding the prefix... i.e (defun LM:WhatMyFunctionIs )
 

These prefixes may help you when posting code on forums or discussion groups
for support. As you get ready to post your code you may notice those toolbox functions due to


their prefix and include those external functions. This makes it easier to get support.
 
now as for this..
 
 
Beacuse those prefix are normally associated with routine names and not for variable names.
now variable naming convention is another thing..
 
simply put. its a good practice for programemrs all over the world to follow.
you dont have to do this is what i'm trying to tell you.. but then again,... see previous post
 
 
 
Hope this helps
 

 

Michaels 发表于 2022-7-6 10:37:38

Exactly pBe.
 
But for me as a beginner of Lisp , I am trying to get used to things that most of excellent programmers do .
 
So that's why I have been trying to use some of others' ways of handling things like that .
 
Greatly appreciated pBe.
 
Thank you .

Lee Mac 发表于 2022-7-6 10:41:12

Since you aren't willing to give it a try, or indicate which part of my explanation wasn't clear, here is an example for you to copy/paste into your code whilst still not understanding its inner workings:
 

(defun c:test ( / acdoc acblk acsel name done ) (vl-load-com) ;;---------------------------------------------;; ;; Example © Lee Mac 2011-www.lee-mac.com;; ;;---------------------------------------------;; (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))       acblk (vla-get-Blocks acdoc) )(if (ssget '((0 . "INSERT")))   (progn   (vlax-for block (setq acsel (vla-get-ActiveSelectionSet acdoc))       (if         (not         (member             (setq name               (vlax-get-property block               (if (vlax-property-available-p block 'effectivename)                   'effectivename                   'name               )               )             )             done         )         )         (progn         (vlax-for obj (vla-item acblk name)             (if (eq "AcDbCircle" (vla-get-Objectname obj))               (vla-put-color obj acred)             )         )         (setq done (cons name done))         )       )   )   (vla-delete acsel) (vla-regen acdoc acallviewports)   ) ) (princ))

alanjt 发表于 2022-7-6 10:45:34

......................
页: 1 [2]
查看完整版本: 添加ssget以选择特定B