Jump to content

Recommended Posts

Posted

hi dear friends

:(pleae help me for problem in easy code:

(defun c:test4()

(defun getpoly ()

(command "area" "object" ent)

(getvar "perimeter")

)

(setq ent (car(entsel)))

)

Posted
(defun c:test4 ()
 (setq ent (car (entsel)))
 (command "area" "object" ent)
 (getvar "perimeter")
)

Posted

dear mostafa

 

 

 

 

I mean this was not, i want define multiple function in one code and use them, similar to JefferyPSanders writen for addlength,

Something like this:

(defun c:test4 ()

; ;;;--- Function to get the length of an ARC entity

(defun getArc(en)

(command "lengthen" en "")

(getvar "perimeter")

)

 

;;;--- Function to get the length of a LINE entity

(defun getLine(en)

(setq enlist(entget en))

(distance (cdr(assoc 10 enlist)) (cdr(assoc 11 enlist)))

)

 

;;;--- Function to get the length of a POLY, CIRCLE, SPLINE, OR ELLIPSE

(defun getPoly(en)

(command "area" "Object" en)

(getvar "perimeter")

)

.

.

.

.

.

)

Posted

maybe this help.

[color=red](getPoly (car (entsel)))[/color]
(defun getPoly(en)
(command "area" "Object" en)
(getvar "perimeter")
)

Posted

mostafa, red line must be the last one... Order of loading functions is also important...

 

M.R.

Posted (edited)

:)thanks dear mostafa & marko

my problem is solved.

Edited by hamidciv
Posted
thanks asos for help me.

You are most welcome

Posted

Oops thanks marko you right. the defun must be loaded firstly.

mostafa, red line must be the last one... Order of loading functions is also important...

 

M.R.

Posted

If you use VL you can Vl-get-area so will work for plines and circles also vl-get-length.

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...