Jump to content

Redefined block by code problem


Hopeless Turtle

Recommended Posts

I've made a program to redefine a block between 2 forms. They are fairly basic blocks with a polyline and circles. The problem is the block still behaves like the original in regards to selection. Clicking the new block doesn't work. It's like there's a ghost of the original block that you have to use to interact with it. Is there some regen or similar function that would fix this?

 

Here's the code for reference.

(defun c:standardbaseplates ()
  (entmake (list
             (cons 0 "BLOCK")
             (cons 2 "_BASEPLATE_")
             (cons 10 '(0.0 0.0 0.0))
             (cons 70 0)
          ))
  (entmake (list
             (cons 0 "LWPOLYLINE")
             (cons 100 "AcDbEntity")
             (cons 100 "AcDbPolyline")
             (cons 90 8)
             (cons 70 0)
             (cons 62 256)
             (cons 8 "0")
             (cons 10 (list -0.875 -4.75))
             (cons 10 (list -3.5 -4.75))
             (cons 10 (list -3.5 -1.0))
             (cons 10 (list -2.25 0.25))
             (cons 10 (list 2.25 0.25))
             (cons 10 (list 3.5 -1.0))
             (cons 10 (list 3.5 -4.75))
             (cons 10 (list 0.875 -4.75))
          ))
  (entmake (list
             (cons 0 "CIRCLE")
             (cons 10 (list 2.5 -3.75))
             (cons 40 0.3125)
             (cons 62 256)
             (cons 8 "0")
           ))
  (entmake (list
             (cons 0 "CIRCLE")
             (cons 10 (list -2.5 -3.75))
             (cons 40 0.3125)
             (cons 62 256)
             (cons 8 "0")
           ))
  (entmake (list
             (cons 0 "ENDBLK")
             (cons 8 "0")
          ))
  (vla-regen (vla-get-activedocument(vlax-get-acad-object)) acAllViewports)
)

(defun c:seismicbaseplates ()
  (entmake (list
             (cons 0 "BLOCK")
             (cons 2 "_BASEPLATE_")
             (cons 10 '(0.0 0.0 0.0))
             (cons 70 0)
          ))
  (entmake (list
             (cons 0 "LWPOLYLINE")
             (cons 100 "AcDbEntity")
             (cons 100 "AcDbPolyline")
             (cons 90 6)
             (cons 70 0)
             (cons 62 256)
             (cons 8 "0")
             (cons 10 (list -0.875 -6.0))
             (cons 10 (list -4.0 -6.0))
             (cons 10 (list -4.0 2.0))
             (cons 10 (list 4.0 2.0))
             (cons 10 (list 4.0 -6.0))
             (cons 10 (list 0.875 -6.0))
          ))
  (entmake (list
             (cons 0 "CIRCLE")
             (cons 10 (list -3.0 -5.0))
             (cons 40 0.3125)
             (cons 62 256)
             (cons 8 "0")
           ))
  (entmake (list
             (cons 0 "CIRCLE")
             (cons 10 (list -3.0 1.0))
             (cons 40 0.3125)
             (cons 62 256)
             (cons 8 "0")
           ))
  (entmake (list
             (cons 0 "CIRCLE")
             (cons 10 (list 3.0 -5.0))
             (cons 40 0.3125)
             (cons 62 256)
             (cons 8 "0")
           ))
  (entmake (list
             (cons 0 "CIRCLE")
             (cons 10 (list 3.0 1.0))
             (cons 40 0.3125)
             (cons 62 256)
             (cons 8 "0")
           ))
  (entmake (list
            (cons 0 "ENDBLK")
            (cons 8 "0")
          ))
  (vla-regen (vla-get-activedocument(vlax-get-acad-object)) acAllViewports)
)

 

Link to comment
Share on other sites

The problem is, after it's redefined you can't click on the new geometry. It only selects it from where the old geometry used to be. As if it's not fully redefined.

Link to comment
Share on other sites

For me look at a dynamic block you can enter parameters and the object will change size to suit. Len & Ht, Rad, offset X & Y

 

Or a lisp that draws the plate to the size you want then can make a block of the new baseplate "Base300x200" the name from the values entered.

 

Something like make a selection set of what was just created then use  "-block" follow the prompts to see how you would do in a (command "-block" 

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