Attaching 3d coordinates as a point on the surface of a model

Attaching 3d coordinates as a point on the surface of a model

Anonymous
Not applicable
1,293 Views
1 Reply
Message 1 of 2

Attaching 3d coordinates as a point on the surface of a model

Anonymous
Not applicable

 Hello!


I'm fairly new to this community, so please forgive me if I'm in the wrong posting here.

Here's my situation.  I'm a software developer and I work with some engineers that have this process they use to input/display information on vehicle parts.

 

1.  They have built AutoCAD models of all the vehicle parts. 

2.  Some mechanic inspects a real life vehicle part and makes notes on wear/tear/location and pass it along to a data entry technician. 

3.  The data tech then inputs the discrepancy locations as x,y,z columns in an access database.

4.  The engineers load up the model, then using a VBA script, load up the discrepancies and plot them as dots (small spheres) that show up around the model.

 

Here's the problem.  They want to apply a kind of heat map, based on the cluster density of the discrepancies, over the surface of the object.  I believe the dots need to be a part of the object in order for this to work.  Changing their data input process is not an option at the moment.  I'm stuck with using the data I currently have.

 

Is there any built in AutoCAD method to snap a point to the closest surface point of a model?  Some API I can programmatically access to accomplish this.  I'm sure I can get the math of it if i need to re-write the script, but how to attach the point to the model and to make sure AutoCAD knows its a discrepancy point so I can apply the mapping?

 

Any thoughts are appreciated,

Thanks!

Carlos

 

 

 

0 Likes
1,294 Views
1 Reply
Reply (1)
Message 2 of 2

norman.yuan
Mentor
Mentor

Not knowing how much you know/do AutoCAD VBA programming and not exactly understanding the process out of your description, it seems to me that this is what you want: presenting a searies of point (i.e. coordinates of x, y and z), stored in database (MS Access) VISUALLY with the 3D model in AutoCAD.

 

So, yes, you can do it with AutoCAD VBA. The result would be like:

 

When the 3D model is loaded into AutoCAD, user runs your VBA code, the points then are read into AutoCAD and are drawn as AutoCAD point entity (AcadPoint object), or other type of entity of your choice (a solid ball, donuts, a patch of small surface, whatever), as the presentation of the discrepancies.

 

The VBA code would be cover 2 operations:

 

1. Read data from external data source. Since it is MS Access, you need to download and install MS Access Database Engine, unless the AutoCAD computer has MS Access installed. Since it is very likely your AutoCAD is 64-bit, the DB engine must also be 64-bit. Once the DB Engine installed, then you can use ADO to read data in the database.

 

2. Assume the points have correct coordinates in relation to the model, thus, your VBA code can simply create AutoCAD entities according to the point coordinates regardless the model. That is, what the VBA program does has nothing to do directly with the model. The data collecting technician is responsible to get the coordinates correctly, so the points would fall onto the correct spots of the model). So, for example, you can simply draw all the points as AcadPoint into the ModelSpace like this:

 

Dim pt As Variant '' a 3-element array of Double, represent a point

For Each pt in MyPoints

    ThisDrawing.ModelSpace.AddPoint pt

Next

 

You can set Acad's system varables "PDMODE/PDSIZE" to control point resentations in AutoCAD. Or, as afrementioned, you can use the coordinates to create a other type of entities for the presentation, such as 

 

ThisDrawing.ModelSpace.AddSolid()/AddSphere()/AddRegion()...

 

As you can see, as long as the points' coordinates are good, there is no need to calculate.

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes