Jump to content

ActiveX methods


Trudy

Recommended Posts

Hello everyone, sorry if my question is stupid but i dont understands how it work.

I want to ask after  "(vlax-dump-object obj T)" and find all methods.

 

; Methods supported:
;   AddPointMultiple (1) ;   ArrayPolar (3) ;   ArrayRectangular (6) ;   Copy () ;   CreateSnapshot () ;   Delete () ;   ExtractBorder (1) ;   ExtractContour (4) ;   FindElevationAtXY (2) ;   GetBoundingBox (2)
.................................... others.

In my case i dump Tin surface.

 

Question is how can i use them, i found for this (setq contours (vlax-invoke-method obj 'FindElevationAtXY X Y))

(setq something (vlax-invoke-method obj 'ExtractContour ? ? ? ?)) if i understand right i need 4 parameters but dont know where to find them.

Where or how i can see for each method what is the parameter.

 

My goal is to extract grid lines from surfaces.

 

Thank you :)

 

 


 

 

Link to comment
Share on other sites

It's normally located under this link of your own PC:

"C:\Program Files\Common Files\Autodesk Shared"

 

Look for the file "acadauto.chm". You'll find all the methods and the parameters each one takes.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Well you learn something new every day 

 

Google 'ExtractContour CIV3D help 

 

Not sure why when you can use the aecexporttoautocad command, trying to remember the exact wording need to go in and look it up used it before more options than just contours. depends on what is displayed.

 

Grid lines there is a grid option in Civ3d now where is it I think in the add points to surface options look in ribbon.

 

Hmmmm Google "grid  CIV3D help"

 

Need togo exploring again.

Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

Hello BIGAL i want to create something with dcl and i need the grid when i can create in surface. And from that i know  its not very good to use command in dcl.

And for that reason i search for other way to create the grid in surface boundaries.

Link to comment
Share on other sites

When you say grid lines to clarify are you saying sections or XYZ of a grid point, 10,10 10,20 etc 

 

Making a list of grid points is straight forward. Then use the  'FindElevationAtXY

 

; pick a surface must be able to see it
(setq obj (vlax-ename->vla-object (car  (entsel "Pick obj"))))

(setq pt (vlax-invoke-method obj 'FindElevationAtXY 268720.297  5781240.625))

16.375

Link to comment
Share on other sites

Hi BIGAL  i want to create something similar i need the grid sections and i think i can extract intersect points after that i have to make all of the grid like polygons and after that at intersect point i will extract elevation.

 

Problem for now is the Grid in surface.

And after all of the stuff i want to create one DCL for everything.

 

Thank you for help :)

Link to comment
Share on other sites

On 12/17/2020 at 1:11 AM, Trudy said:

Hello everyone, sorry if my question is stupid but i dont understands how it work.

I want to ask after  "(vlax-dump-object obj T)" and find all methods.

 

; Methods supported:
;   AddPointMultiple (1) ;   ArrayPolar (3) ;   ArrayRectangular (6) ;   Copy () ;   CreateSnapshot () ;   Delete () ;   ExtractBorder (1) ;   ExtractContour (4) ;   FindElevationAtXY (2) ;   GetBoundingBox (2)
.................................... others.

In my case i dump Tin surface.

 

Question is how can i use them, i found for this (setq contours (vlax-invoke-method obj 'FindElevationAtXY X Y))

(setq something (vlax-invoke-method obj 'ExtractContour ? ? ? ?)) if i understand right i need 4 parameters but dont know where to find them.

Where or how i can see for each method what is the parameter.

 

My goal is to extract grid lines from surfaces.

 

Thank you :)

 

 


 

 

 

 

http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib__IAeccSurface__ExtractContour@[in]_AeccDisplayOrientation@[in]_AeccSurfaceFilterType@[in]_double@[in]_double@[out,_retval]_VARIANT_.htm

 

 

 

 


(defun c:ExtractContour_MIN_MAX  (/ c3d c3ddoc surfs *acad* surf contours)
  (vl-load-com)
  (if (and (setq ss (ssget ":S" '((0 . "AECC_*_SURFACE"))))
	   (setq surf (vlax-ename->vla-object (ssname ss 0)))
             (setq surstatistics(vlax-get surf 'statistics))
	   ;(setq low (getreal "\nMinimum Elevation: "))
	   (setq low (vlax-get surstatistics 'minelevation))
	   ;(setq high (getreal "...Maximum Elevation: "))
	   (setq high (vlax-get surstatistics 'MAXelevation))
	   (setq *acad*	(vlax-get-acad-object)
		 c3d	(strcat	"HKEY_LOCAL_MACHINE\\"
				(if vlax-user-product-key
				  (vlax-user-product-key)
				  (vlax-product-key)
				)
			)
		 c3d	(vl-registry-read c3d "Release")
		 c3d	(substr	c3d
				1
				(vl-string-search
				  "."
				  c3d
				  (+ (vl-string-search "." c3d) 1)
				)
			)
		 c3d	(vla-getinterfaceobject
			  *acad*
			  (strcat "AeccXUiLand.AeccApplication." c3d)
			)
	   )
      )
    (progn
      (setq c3ddoc (vlax-get c3d 'activedocument)
	    surfs  (vlax-get c3ddoc 'surfaces)
      )
      (setq surf (vlax-ename->vla-object (ssname ss 0)))
     


      (setq contoursm (vlax-invoke surf 'ExtractContour 1 4 low high))
      (setq contoursn (vlax-invoke surf 'ExtractContour 1 5 low high))


      (if (not (vlax-object-released-p c3d))
	(vlax-release-object c3d)
      )
      (if (not (vlax-object-released-p *acad*))
	(vlax-release-object *acad*)
      )
    )    ;;(progn
  )  ;;	(if
  (princ)
  )

 

 

Link to comment
Share on other sites

For Trudy If you can make the grid then you can make two lists the horizontal lines and the vertical lines and get the intersection points and end points then get Z.

 

Having done something with grids recently my attack would be to pick lower left and upper right point, you do a rounding down but not decimal place but down to the grid even values eg 123.45,678.9 =120,670 for 10m grid spacing once you have this you can make a list using double repeat to make all points required you can also add the intersecting boundary points if required. Running (setq pt (vlax-invoke-method obj 'FindElevationAtXY 120 670)) will return a Z or not. 

 

Tested gives 

(setq ptxyz (vlax-invoke-method obj 'FindElevationAtXY (car pt)  (cadr pt)))
; error: Automation Error. Point outside surface

or 

17.293

 

Need some help as it does a automation error need to trap and continue to next point, not just exit may need something that looks at error message for say "Automation" have something but running out of time other stuff starting to back up. I think the getpoint is a defun so error  restarts defun again.

image.png.b1c15b846ca57f17533eb0017d1d1d91.png

 

An example of rounding  down to 10

(setq cenx 123.45 ah:spc 10)

(cond 
((> 100.0 ah:spc)(setq  lstr 2))
((> 1000.0 ah:spc)(setq lstr 3))
)

(setq  newcenx (rtos cenx 2 0))
(setq newcenintx  (substr newcenx 1 (- (strlen newcenx) lstr)))
(setq numrem  (fix (/ (atof (substr newcenx (- (strlen newcenx)(-  lstr 1)))) ah:spc)))
(if (= numrem 0)
(setq newcenintx  (atof (strcat newcenintx "00")))
(setq newcenintx (atof (strcat newcenintx (rtos (* numrem ah:spc) 2 0))))
)

 

 

 

Edited by BIGAL
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...