Can I use a carlson command in autolisp?

Can I use a carlson command in autolisp?

etilley327KA
Advocate Advocate
799 Views
10 Replies
Message 1 of 11

Can I use a carlson command in autolisp?

etilley327KA
Advocate
Advocate

Is there any way to use and pass a variable data to another program? I have a lisp for autocad, but I would like to add a carlson command into it, is this possible?

0 Likes
800 Views
10 Replies
Replies (10)
Message 2 of 11

Kent1Cooper
Consultant
Consultant

If the Carlson command in question does something that AutoCAD could be customized to do, it's surely possible to make that customization by way of AutoCAD commands and AutoLisp functions.  But if you're talking about actually "reaching into" Carlson software somehow, to perform something in a drawing that you have open in AutoCAD [since presumably that would be the only context in which you could be using an AutoLisp routine], that doesn't seem possible.

 

Can you give an example of the kind of thing you would be wanting to do?

Kent Cooper, AIA
0 Likes
Message 3 of 11

etilley327KA
Advocate
Advocate

Thanks, I was just looking into if it was possible. Im trying to enlarge the points selected which I do through carlson. I was able to do this through CAD but it only increases the text size and disables the abilities of the points for other uses.

I was trying to see if the point data could be passed to carlson kind of like a macro but were it says screen selection pass it my variable data. I knew it was farfetched, just wondering if anything was out there.

0 Likes
Message 4 of 11

Sea-Haven
Mentor
Mentor

When you say points are they COGO points as in the type CIV3D would make. Then yes can do lots of stuff to a "Point"

 

Post a dwg so can look at the "Point".

0 Likes
Message 5 of 11

etilley327KA
Advocate
Advocate

Here's a DWG with some points.

0 Likes
Message 6 of 11

Kent1Cooper
Consultant
Consultant

@etilley327KA wrote:

.... Im trying to enlarge the points selected which I do through carlson. I was able to do this through CAD but it only increases the text size and disables the abilities of the points for other uses.

I was trying to see if the point data could be passed to carlson kind of like a macro but were it says screen selection pass it my variable data. ....


What other than increasing the text size could you mean by "enlarge"?  And what "other uses" are they "disable[d]" from?  [It's hard for me to imagine something that couldn't work with a Block at any scale, especially if the one piece of information that would seem relevant to anything is its insertion point, which is independent of scale.]

 

The passing-to-Carlson issue sounds like a question to pose in a Carlson forum, rather than here.  What format(s) can it accept?  Does the function it would use the information for affect the appropriate format(s)?  With answers to questions like those, someone might be able to say whether AutoCAD is able to export suitable information.

Kent Cooper, AIA
0 Likes
Message 7 of 11

etilley327KA
Advocate
Advocate

Cool, thanks for the info. Ill check on a carlson forum. 

0 Likes
Message 8 of 11

Sea-Haven
Mentor
Mentor

Maybe this, its very quick and dirty.

 

 

(defun c:rscaleblk ( / ss x ent layname bname obj)
(setq sc (getreal "\nEnter new scale "))
(setq ent (entget (car (entsel "\nSelect block to change "))))
(setq layname (cdr (assoc 8 ent))
bname (cdr (assoc 2 ent))
)
(setq ss (ssget (list (cons 0 "INSERT")(cons 2 bname)(cons 8 layname))))
(if (= ss nil)
(progn
  (alert "Nothing slected will exit now try again ")
  (exit)
)
(progn
(repeat (setq x (sslength ss))
  (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
  (vla-put-XEffectiveScaleFactor obj sc)
  (vla-put-yEffectiveScaleFactor obj sc)
)
)
)
(princ)
)
(c:rscaleblk)

 

Message 9 of 11

etilley327KA
Advocate
Advocate

Cool! I tried to modify this to fit my preexisting lisp to no avail. Could you help a little further, how might I use this with a variable of the objects already selected and a preset scale factor.

0 Likes
Message 10 of 11

Sea-Haven
Mentor
Mentor

If you have already selected then why not just use properties and change the scale. No code required.

 

Or have you changed 1 block and want to match to that scale ?

 

; (setq sc (getreal "\nEnter new scale "))
(setq ent (entget (car (entsel "\nSelect block to change "))))
(setq layname (cdr (assoc 8 ent))
bname (cdr (assoc 2 ent)
sc (cdr (assoc 41 ent))
)
0 Likes
Message 11 of 11

etilley327KA
Advocate
Advocate

This is my LISP, I'm currently trying to change the size of the gathered objects to an increased prefixed size. I was hoping to use carlson to change the size, but that seems unlikely, so how would I go about just changing the size without them moving away from their location.

 

(defun c:FDER ( / A)
(princ "\nSelect Points ")
(setq A (ssget))
(vl-cmdf "._change" A "" "_p" "_la" "00-form" "")
(command "_LAYER" "_OFF" "SHOT" "_F" "SHOT"
"_C" "255" "0ELEV,PNTELEV" "")
(setq old "SHOT"
new "RSHOT"
)
(if (and (setq obj (tblobjname "layer" old))
(setq enx (entget obj))
)
(entmod (subst (cons 2 new) (assoc 2 enx) enx))
)
(princ)
)

0 Likes