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

vla-get-insertionpoint precision

1 REPLY 1
SOLVED
Reply
Message 1 of 2
Anonymous
2449 Views, 1 Reply

vla-get-insertionpoint precision

I use a routine to have people insert blocks out of our library and then add additional blocks (if needed) and the block name at a y-axis offset too.

 

I've been experiencing problems with getting where the initial block (B_TEMP in the example) is placed by the user.

 

If I use

( setq BPOINT ( vlax-get B_TEMP 'InsertionPoint ) )

or

( setq BPOINT ( vlax-safearray->list ( vlax-variant-value ( vla-get-InsertionPoint B_TEMP ) ) ) )

 The results are pretty good... close up... but in AutoCAD (Mech) 2015 SP1... it becomes dodgy when I have zoomed out "too far"

 

profiles.png

 

The profile on the left was inserted while zoomed out, the profile on the right was inserted while zoomed in on the first. The red block should be inserted twice, with an x scale of -1. Results are the same if I had inserted a completely different white block instead of the same.

 

Is the vl insertion point determined based on screen location/accuracy or something?

 

Do I need to use DXF codes and such instead?

 

This issue started when I replaced

( if
								( setq BPOINT ( vla-getpoint ( vla-get-utility B_FILE ) nil "\nSelecteer een punt om het block te plaatsen: (0,0)" ) )
								( setq BPOINT ( vlax-safearray->list ( vlax-variant-value BPOINT ) ) )
								( setq BPOINT '( 0.0 0.0 0.0 ) )
							)
							( vla-InsertBlock ( vla-get-modelspace B_FILE ) ( vlax-3d-point BPOINT ) B_NAME 1 1 1 0 )

  by the following function,

 

( defun B_Sub_Drag_Move ( B_OBJ / B_TAKE B_CODE B_PNT3 )
	( while
		( and
			( setq B_TAKE ( grread 't ) )
			( /= ( car B_TAKE ) 3 )
		)
		( setq B_CODE ( car B_TAKE ) )
		( setq B_PNT3 ( cadr B_TAKE ) )
		( if
			( and B_PNT3 ( = B_CODE 5 ) )
			( vla-move B_OBJ ( vla-get-insertionpoint B_OBJ ) ( vlax-3d-point B_PNT3 ) )
		)
	)
	( princ )
)

;; Ghosting move by Luis Esquivel
;; Style changes by A.Zwegers

 

which is called by a load and used as

( setq B_TEMP ( vla-InsertBlock ( vla-get-modelspace B_FILE ) ( vlax-3d-point '( 0.0 0.0 0.0 ) ) B_NAME 1 1 1 0 ) )
							( B_Sub_Drag_Move B_TEMP )

 

The thing is that the old version, or even getpoint, will not show the profile while inserting. The MTEXT (or TEXT) would still end up dodgily when inserted at a further zoom - but at least the secondary blocks would be inserted.

 

Since I'm at a loss on how to deal with this any furher (and am probably just doing this in a far too complex manner... I'm wondering if anyone has any other options...

 

(Strangely... I haven't received much compliants from users - since they apparently tend to have zoomed in... but this should be more fool proof. I've also noticed that on older drawings or drawings based on older templates it goes to even bigger messes. (secondary blocks and text not appearing at all)

1 REPLY 1
Message 2 of 2
Lee_Mac
in reply to: Anonymous

The use of grread for point acquisition will not permit the use of Object Snaps (or any other drawing aids for that matter), therefore, your points will always be inaccurate when using this method to determine the block insertion point - the blocks will effectively be inserted 'by eye'.

 

Since you are looking for a preview of the block as it is inserted, I would recommend using the standard INSERT command, with a pause for the insertion point, e.g.:

 

(vl-cmdf "_.-insert" b_name "_s" 1.0 "_r" 0.0 "\\")

 

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

Post to forums  

Autodesk Design & Make Report

”Boost