Jump to content

Recommended Posts

Posted

Hi

how can I append a 3d sphere into the drawing. Sample below works for the circle but not for the spheres why and how to solve this ;) thx

    
Public Sub addSpheres()
Dim lcmd As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Dim acbaza As Database = lcmd.Document.Database
Using trn As Transaction = acbaza.TransactionManager.StartTransaction
       Dim btr As BlockTableRecord = CType(trn.GetObject(acbaza.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)
       Dim sph As Sphere = New Sphere(1, New Point3d(1.0, 1.0, 1.0), Vector3d.XAxis, Vector3d.YAxis, 0.0, 0.0, 0.0, 0.0)
       btr.AppendEntity(sph)
       trn.AddNewlyCreatedDBObject(sph, True)
       trn.Commit()
End Using
End Sub

Posted

You could insert a circle and revolve said circle into a sphere

 

EDIT:

 

(setq f(vla-addsphere 
 (vla-get-modelspace
   (vla-get-activedocument
     (vlax-get-acad-object))) 
 (vlax-3d-point(list 0.0 0.0 0.0 ))    ;Insertion point
  20.0))                                     ;Radius

The above code is what you're looking for i think

 

I don't have VBA in 2010 but the code should be roughly

 

Activedocument.modelspace.addsphere(insertionPoint, radius)

 

As far as I am aware pre existing entites don't require a constructor statement in VBA

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