Hello All,
I had run a macro to offset a shape element (inside polygon).But i didn't get output shape element inside instead it was placed outside.how to accomplish this? please help.
Thanks in advance.
Kanmani kandaswamy.
Here is the code i have tried.
Private Function offsetBuffer(dist As Double, shp As ShapeElement, insidePt As Point3d) As ShapeElementDim startPoint As Point3dDim Point As Point3d, point2 As Point3dDim lngTemp As LongDim newElem As ShapeElementDim offElem As ElementDim resltShp As ShapeElementSet newElem = CreateShapeElement1(Nothing, shp.GetVertices)ActiveModelReference.UnselectAllElementsActiveModelReference.SelectElement shp
CadInputQueue.SendCommand "MOVE PARALLEL OFFSET "
SetCExpressionValue "tcb->ms3DToolSettings.offsetCurve.makeCopy", 1, "3DMODIFY"CadInputQueue.SendCommand "MOVE PARALLEL OFFSET "SetCExpressionValue "tcb->ms3DToolSettings.offsetCurve.activeSymb", 1, "3DMODIFY"CadInputQueue.SendCommand "MOVE PARALLEL OFFSET "SetCExpressionValue "tcb->ms3DToolSettings.offsetCurve.distance.value", (ActiveModelReference.UORsPerMasterUnit * dist), "3DMODIFY"CadInputQueue.SendDataPoint insidePt,1CadInputQueue.SendDataPoint Point3dZero, 1
CommandState.StartDefaultCommandSet offElem = ActiveModelReference.GetLastValidGraphicalElementSet offsetBuffer = offElemEnd Function
Hi kanmani,
at first, please use Syntaxhighlighter tool (yellow pencil icon) with properly set language (VB in your case) when posting any code. It ensures the code will be displayed and colorized properly as code, not as plain text (which is ugly).
Also, don't duplicate your posts! You asked the same question in Developers and Programming forum, which is confusing, at least because it's not clear what question and related discussion is the right one.
You did not mention what product and version (build number) do you use. E.g. V8i and CONNECT Edition behaviour can be quite different.
Unknown said:But i didnt get output shape element inside instead it was placed outside.
It's probably because of first and second points relative positions.
Unknown said:how to accomplish this?
To use MicroStation key-ins from the code, when user's actions have to be simulated, is often tricky. I guess there are two possible solutions:
I recommend to search this web for similar topic, because I remember copy parallel in VBA was discussed several times in the past.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point