erickson19886 Posted September 6, 2016 Posted September 6, 2016 (edited) Hello everyone, I'm Erick and I'm new in this forum. Also, I'm a beginner in creating LISP. I need your help to create a code that will do the following items. 1. Automatic insert of a block (this .DWG block can be found on the same directory as the drawing template) to an open drawing template. 2. During insert, LISP should put the block in fixed location (0, 0), then scale it to a fixed scale factor (i.e. 0.5, 0.5) and will have a fixed rotation (0 deg). Thank you in advance. Hoping you'll help me on this first project. Block.dwg DWG_Template.dwg Edited September 6, 2016 by erickson19886 Add attachment Quote
Tharwat Posted September 6, 2016 Posted September 6, 2016 (edited) Hi Erick, welcome to CADTutor. Here is a start for you to test out and also you can use the command call "-insert" as well if you find the vla-* functions hard to deal with at the mean time. (vla-insertblock (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)) ) (vlax-3d-point '(0. 0. 0.)) "C:\\Users\\Tharwat\\Desktop\\Drawing1.dwg" ;; Replace this path of drawing with yours 0.5 0.5 1.0 0. ) Edited July 1, 2022 by Tharwat Quote
erickson19886 Posted September 6, 2016 Author Posted September 6, 2016 Hi Erick, welcome to CADTutor. Here is a start for you to test out and also you can use the command call "-insert" as well if you find the vla-* functions hard to deal with at the mean time. (vla-insertblock (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))) (vlax-3d-point '(0. 0. 0.)) [color="magenta"]"C:\\Users\\Tharwat\\Desktop\\Drawing1.dwg"[/color] [color="olive"];; Replace this path of drawing with yours[/color] 0.5 0.5 1.0 0.) Hi Tharwat, Good day. Thanks a lot for the helpful code that you just shared. It really works the way I planned it to. Also, this is a good start for me. I will just do some study to understand the code. Quote
BIGAL Posted September 7, 2016 Posted September 7, 2016 You may want to look at tool palettes if your going to do this for lots of blocks, maybe something like this older method via menu's. Quote
Tharwat Posted September 7, 2016 Posted September 7, 2016 The OP needs codes to use and to learn from it and that's why they posted in AutoLISP forum. Quote
Recommended Posts
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.