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

Lisp to Move Block from Insertion relative to Point Offset from Attribute Value

4 REPLIES 4
Reply
Message 1 of 5
kblackburn
1002 Views, 4 Replies

Lisp to Move Block from Insertion relative to Point Offset from Attribute Value

I have blocks that were inserted in a drawing as part of program feature. The blocks have a LOCATION attribute (x y z) that indicates where the block is in reference to. The blocks have a different x y z values because of the programs attempt to place the block near the reference for clarity. To be more clear and to be visually able to see the reference point, I need to move these blocks from the insertion of the block relative to the LOCATION attribute values.

See attached Screen Shot 1.

I can do a move from the block insertion and chose a point offset from within the move command with the LOCATION attribute values (-3160.29,1372.43) which shows me that the block  is associated with the center of red circle in Screen Shot 2a. What I would like is a custom move command that automates the base point insertion and point offset from the LOCATION attribute values.

4 REPLIES 4
Message 2 of 5
kblackburn
in reply to: kblackburn

I created a screen capture video showing the process I would like a lisp to automate if anyone could please help. See link below.

https://autode.sk/2N0BJs1 

 

Thanks in advance for your time.

 

 

Message 3 of 5
JamesMaeding
in reply to: kblackburn

@kblackburn 

so you need code to do these tasks:

1) get location of an attribute from its tag (must have unique tags if multiple atts...)

2) get block insert location

3) move block that is already inserted

4) move atts by some vector, for block already inserted

 

Here is some code to help you get started. You will need to learn some lisp for this, and generally its not good to rely on customization you cannot maintain so that is expected IMO.

;(MAKE-LIST-OF-ATTRIBS-PTS (CAR (ENTSEL)))
(defun MAKE-LIST-OF-ATTRIBS-PTS (EN / BLK ATT RET)
  (SETQ BLK (VLAX-ENAME->VLA-OBJECT EN))
  (IF (= (VLA-GET-HASATTRIBUTES BLK) :VLAX-TRUE)
    (FOREACH ATT (VLAX-SAFEARRAY->LIST (VLAX-VARIANT-VALUE (VLA-GETATTRIBUTES BLK)))
      (SETQ RET (CONS (LIST (VLA-GET-TAGSTRING ATT) (VLA-GET-TEXTSTRING ATT) (GET-TXT-INSPT ATT)) RET))
    )
  )
  (REVERSE RET)
)

That is not beginner lisp either. All that VLA junk is "com" language, like VBA properties.

The tasks I identified above are not too hard, but they involve stuff relative to a given block which may have rotation and scale to deal with.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 4 of 5
kblackburn
in reply to: JamesMaeding

Thanks for the response. Here is a link to a screencast of what I would like a lisp to automate. It would be essentially a custom move command that reads the value of the attribute in the block selected as uses that as the _from base point. Hope this helps.

 

https://autode.sk/2N0BJs1 

Message 5 of 5
JamesMaeding
in reply to: kblackburn

@kblackburn 

sorry, you will have to do some coding.

You can occasionally get full free service on things that have been done before so we are just paying forward, but this one is something you need to dig into.

Now that I said that, can you mention why you have not done that yet? Do you have any programming experience? Is it the time?

I'm always curious as LISP is fairly easy to pick up, and we can help a lot, but so many people don't its a shame.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

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

Post to forums  

Autodesk Design & Make Report

”Boost