Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hello All,
Am having trouble creating rectangular section using PRO_E_SKETCHER. If i create 4 individual lines and add it using SectionEntityAdd then the feature will not get properly created. Its not being treated as rectangular entity but as 4 individual lines.
It will be really great if someone helps! Thanks in advance.!
Regards,
Pradhyumna
In an interactive session if you sketch a rectangle you end up with 4 individual lines. The Pro2dEntdef enumeration doesn't contain anything to resemble with a rectangle, therefor getting 4 individual lines is the expected result.
To be able to proceed with the feature creation check the output of the ProSectionSolve function. If is anything else than PRO_TK_NO_ERROR you can get details about what's wrong by verifying the ProWSecerror array(second argument of ProSectionSolve) Use ProSecerrorItemGet and ProSecerrorMsgGet functions to get informations about each of the errors.
Also, in ProFeatureCreate, you can set the ProFeatureCreateOptions argument to PRO_FEAT_CR_FIX_MODEL_ON_FAIL. This will put you in resolve mode and may give you indications about what is wrong.
Gabriel,
Thanks a lot for your suggestion. Will try it out.
I think i found a workaround. I constrained the end points of those 4 individual lines to "same point" and it worked fine.
Regards,
Pradhyumna
Hello Pradhyumna,
if you have been able to solve your issue with the answer from Gabriel, please mark his post as Correct Answer.
If your workaround is different, maybe you want to share the information about what else needs to be considered for the solution.
Thanks,
Gunter
Hi Gunter,
I tried ProSectionSolve function, but its giving PRO_TK_GENERAL_ERROR and its crashing when i use ProSecerrorItemGet and ProSecerrorMsgGet functions. Am unable to figure out the error in my code.
Workaround that I figured out is -
1. I first used ProSectionIntentManagerModeSet and set it true.
2. Then defined 4 individual lines in form of rectangle and added them to the section using ProSectionEntityAdd.
For Ex: line1 - end1 = 10,10 & end2 = 10,110. line2 - end1 = 10,110 & end2 = 110, 110.
line3 - end1 = 110,110 & end2 = 110, 10. line4 - end1 = 110,10 & end2 = 10, 10
This makes all the 4 lines end points to be coincident on adjacent line end points.
3. Then I used ProSectionEntityGetSelected, ProArrayObjectAdd and ProSectionConstraintCreate (PRO_CONSTRAINT_SAME_POINT) to get a rectangular section.
This worked perfectly.
I also think we can eliminate step 3 if we use PRO_2D_POLYLINE in step 2 instead of PRO_2D_LINE. But have to explore.
Regards,
Pradhyumna
Hello Pradhyumna,
Thank you for the information! I am sure this will be helpful for other users in a similar situations.
Gunter
Thanks for your information, it helps me a lot.
Hi xd,
If the solution is working fine, please mark the comment as correct answer.
Pradhyumna