Jump to content

Divide by custom property


Nickvnlr

Recommended Posts

I have this line of code and for the life of me I cannot figure out how to divide by a custom drawing property called "ROW SPACING".

 

...other stuff

(list (list "Total Risers:" (strcat "%<\\AcExpr (Sum(B3:B" (itoa (setq r (+ (length (car x)) 2))) "))/12 \\f \"%lu2%pr0\">%"))) 
;;replace 12 with the drawing property "ROW SPACING"
  
...other stuff

 

How would I do that?  Thank you!

Link to comment
Share on other sites

Put the value of ROW SPACING in the variable RS, and run this code:


(list (list "Total Risers:"
	    (strcat "%<\\AcExpr (Sum(B3:B"
		    (itoa (setq r (+ (length (car x)) 2)))
		    (strcat "))/" (itoa RS) " \\f \"%lu2%pr0\">%")
		    )
	    )
      )

It should work...

Link to comment
Share on other sites

Posted (edited)

I put the ROW COUNT into RS Like so:

(setq RS (getvar "ROW SPACING"))

And then the rest of the suggested code change.

That gives me this error:

Error: bad argument type <NIL> ; expected <INTEGER> at [itoa]

Edited by Nickvnlr
added detail
Link to comment
Share on other sites

I fixed it.

To retrieve a custom property:

(setq si (vla-Get-SummaryInfo (vla-Get-ActiveDocument (vlax-Get-Acad-Object))))
(vla-GetCustomByKey si "ROW SPACING" 'RS) ;;get "ROW SPACING" set to variable RS

 

Since RS is already a string the line will look like this:

(list (list "Total Risers:" (strcat "%<\\AcExpr (Sum(B3:B" (itoa (setq r (+ (length (car x)) 2))) "))/" RS "\\f \"%lu2%pr0\">%")))

 

Link to comment
Share on other sites

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