Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selecting block parameter whit lisp

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Thomas.l
948 Views, 8 Replies

Selecting block parameter whit lisp

Hi

 

I am working on a lisp routine that automaticaly inserts a parameter in a block and then ads a stretch command to it. But the problem is that for the stretch command u need to select the drawn parameter. So my plan was to get the name of this parameter (car (entsel)) and feet it to my lisp program. But when i do that it doesn't work because autocad demands a parameter. 

 

Hope somebody can help me whit this problem

 

Regards

 

Thomas

8 REPLIES 8
Message 2 of 9
pbejse
in reply to: Thomas.l


@Thomas.l wrote:

Hi

 

I am working on a lisp routine that automaticaly inserts a parameter in a block and then ads a stretch command to it. But the problem is that for the stretch command u need to select the drawn parameter. So my plan was to get the name of this parameter (car (entsel)) and feet it to my lisp program. But when i do that it doesn't work because autocad demands a parameter. 

 

Hope somebody can help me whit this problem

 

Regards

 

Thomas


 

Look into GetDynamicBlockProperties method

 

 

Message 3 of 9
Hallex
in reply to: Thomas.l

Try something like this

(setq propname "Wall Height distance") ;<-- property name

(setq propval 1200.0);<-- propert value of double

 (if (setq ss (ssget "_:S" '((0 . "INSERT")(2 . "`*U*,*"))))   ;<-- to change dynamic blocks

  (progn

;get vla-object selected

 (setq blkobj (vlax-ename->vla-object (ssname ss 0)))  

;retrieve desired property list

         (setq proplst (vl-remove-if-not '(lambda (x) (eq (vla-get-PropertyName x) propname ))  

     (vlax-invoke blkobj 'getdynamicblockproperties)))  

;get dynamic property we need 

    (setq prop (car proplst))    

;set desired property value to this property    

     (vla-put-value prop (vlax-make-variant propval 5)) ;<-- 5 is for double value, see Help file

      (vla-update blkobj);<-- update selected block

  )    

   )

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 4 of 9
Thomas.l
in reply to: Hallex

wel that is a piece of interesting code.

But it isn't exactly what i am looking for.

I simply want to be able to ad a stretch action to a stretch parameter whitout having to quite my lisp routine.

 

Regards

 

Thomas

Message 5 of 9
pbejse
in reply to: Thomas.l


@Thomas.l wrote:

wel that is a piece of interesting code.

But it isn't exactly what i am looking for.

I simply want to be able to ad a stretch action to a stretch parameter whitout having to quite my lisp routine.

 

Regards

 

Thomas



Share your code then we'll  incorporate the same method on your routine

 

Message 6 of 9
Thomas.l
in reply to: pbejse

This should give you the idea

 

(setq ang 0)

(defun c:az ()
  (setq pt1 (getpoint "define insertion point:")
	pt2 (polar pt1 (/ (* ang 2 pi) 360) 100))
  (command "bparameter" "linear" pt2 pt1 "500,0" "1")
  (command "baction")
  )

(defun c:aq ()
  (setq ang (+ ang 1))
  (command "bvstate" "set" ang))

 these functions work for block in attachemend when opend in block editor.

 

And thank you both for helping!

 

 

Regards

 

Thomas

Message 7 of 9
pbejse
in reply to: Thomas.l


@Thomas.l wrote:

This should give you the idea

 

 these functions work for block in attachemend when opend in block editor.

 

And thank you both for helping!

 Regards

 

Thomas


Try this way to select the parameter

 

(defun c:az ()
  (setq pt1 (getpoint "define insertion point:")
 pt2 (polar pt1 (/ (* ang 2 pi) 360) 100)
  )
  (command "bparameter" "linear" pt2 pt1 "500,0" "1")
  (command "baction" (nentselp pt1)) ;<--- you do the rest
)

Message 8 of 9
Thomas.l
in reply to: pbejse

Thank you very much that was exactly what i was looking foor.

I realy don't know how i could mis that.

 

Regards Thomas

Message 9 of 9
pbejse
in reply to: Thomas.l


@Thomas.l wrote:

Thank you very much that was exactly what i was looking foor.

I realy don't know how i could mis that.

 

Regards Thomas


You're welcome

Glad i could help

 

Cheers

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost